-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp.sh
More file actions
executable file
·39 lines (32 loc) · 1.21 KB
/
Copy pathphp.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -euo pipefail
provision_setup_php() {
cat >>~/.vimrc <<"EOF"
if executable('php')
" https://github.com/prettier/plugin-php#configuration
autocmd filetype php :exe "nnoremap <silent> <leader>kB :!npx prettier --write %<cr>:e<cr>"
nmap <leader>ll viw"iy:silent exec "!npx open-cli https://developer.wordpress.org/reference/functions/" . '<c-r>i' . " &"<CR>
nmap <leader>lh viw"iy:silent exec "!npx open-cli https://developer.wordpress.org/reference/hooks/" . '<c-r>i' . " &"<CR>
nmap <leader>lf viw"iy:silent exec "!npx open-cli https://www.php.net/manual/en/function." . substitute("<c-r>i", "_", "-", "g") . ".php &"<CR>
nmap <leader>lp :!php -l %<cr>
endif
EOF
cat >>~/.shell_sources <<"EOF"
if type php >/dev/null 2>&1; then
export PATH="$HOME/.config/composer/vendor/bin:$PATH"
fi
if type wp >/dev/null 2>&1; then
if [ ! -f ~/.wp-completion ]; then
echo "Downloading wp-completion"
curl https://raw.githubusercontent.com/wp-cli/wp-cli/v1.5.1/utils/wp-completion.bash \
-o ~/.wp-completion
fi
source_if_exists ~/.wp-completion
fi
EOF
cat >>~/.shell_aliases <<"EOF"
if type php >/dev/null 2>&1; then
alias LaravelServe='php artisan serve --host=0.0.0.0'
fi
EOF
}