-
-
Save timnolte/37a2523333430ca6176507cb022ce8a3 to your computer and use it in GitHub Desktop.
NeoVim as php IDE - Single file setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.local/share/nvim/plugged') | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
Plug 'martinda/Jenkinsfile-vim-syntax' | |
Plug 'c9s/phpunit.vim' | |
Plug 'scrooloose/nerdtree' | |
Plug 'jistr/vim-nerdtree-tabs' | |
Plug 'kien/ctrlp.vim' | |
Plug 'easymotion/vim-easymotion' | |
Plug 'StanAngeloff/php.vim' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
Plug 'tpope/vim-sleuth' | |
Plug 'joonty/vdebug' | |
Plug 'MaxSt/FlatColor' | |
Plug 'janko-m/vim-test' | |
Plug 'tpope/vim-cucumber' | |
Plug 'vim-airline/vim-airline' | |
Plug 'majutsushi/tagbar' | |
" PHP support NVIM | |
Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' } | |
Plug 'junegunn/fzf' | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
Plug 'Shougo/echodoc.vim' | |
call plug#end() | |
"" Maps additional php extensions | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
if has("autocmd") | |
augroup module | |
autocmd BufRead,BufNewFile *.module set filetype=php | |
autocmd BufRead,BufNewFile *.install set filetype=php | |
autocmd BufRead,BufNewFile *.test set filetype=php | |
autocmd BufRead,BufNewFile *.inc set filetype=php | |
autocmd BufRead,BufNewFile *.profile set filetype=php | |
autocmd BufRead,BufNewFile *.view set filetype=php | |
augroup END | |
endif | |
"" Show line numbers. | |
set number | |
set relativenumber | |
"" Automatic indentation. | |
filetype indent on | |
"" Reloads the vim config after saving. | |
augroup myvimrc | |
au! | |
au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif | |
augroup END | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
"" Nerd tree | |
let g:nerdtree_tabs_open_on_console_startup=0 | |
let g:NERDTreeDirArrowExpandable = '▸' | |
let g:NERDTreeDirArrowCollapsible = '▾' | |
""" Key: CTRL+n | Toggle tree | |
map <C-n> :NERDTreeToggle<CR> | |
"" TestSuite | |
" Runner | |
let test#strategy = "neovim" | |
let test#php#cucumber#executable = 'tests/behat -c tests/behat.yml' | |
let test#ruby#cucumber#executable = 'tests/behat -c tests/behat.yml' | |
let test#php#phpunit#executable = 'vendor/bin/phpunit' | |
""" Key: $mod+t | Test nearest | |
""" Key: $mod+T | Test File | |
""" Key: $mod+a | Test suite | |
""" Key: $mod+l | Test Test last | |
""" Key: $mod+g | Test Visit | |
nmap <silent> <leader>t :TestNearest<CR> | |
nmap <silent> <leader>T :TestFile<CR> | |
nmap <silent> <leader>a :TestSuite<CR> | |
nmap <silent> <leader>l :TestLast<CR> | |
nmap <silent> <leader>g :TestVisit<CR> | |
" Maps .feature extension to cucumber | |
augroup filetypedetect | |
au! BufReadPre,BufReadPost,BufRead,BufNewFile *.feature setfiletype cucumber | |
augroup END | |
"" Tagbar | |
autocmd FileType * nested :call tagbar#autoopen() | |
""" key: $mod+F8 | Action: Toggle tagbar | |
nmap <leader><F8> :TagbarToggle<CR> | |
let g:tagbar_autofocus = 0 | |
let g:tagbar_compact = 1 | |
"" Php autocomplete | |
" Disable diagnostics | |
let g:LanguageClient_diagnosticsDisplay = {} | |
" Deoplete config | |
"let g:deoplete#auto_complete_start_length=1 | |
"let g:deoplete#omni_patterns = {} | |
" Required for operations modifying multiple buffers like rename. | |
set hidden | |
let g:LanguageClient_serverCommands = { | |
\ 'php': ['php', '/home/rob/test/vendor/bin/php-language-server.php'], | |
\ } | |
let g:deoplete#enable_at_startup = 1 | |
""" Key: K | Action: Hover | |
""" Key: gd | Action: go to definition | |
""" Key: f2 | Action: Rename | |
nnoremap <silent> K :call LanguageClient_textDocument_hover()<CR> | |
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR> | |
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR> | |
"" Git gutter. | |
let g:gitgutter_sign_column_always = 1 | |
"" Visual settings | |
if has('nvim') | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
colo flatcolor | |
let g:flatcolor_termcolors = 16 | |
set encoding=utf-8 | |
set colorcolumn=80 | |
syntax on | |
"" Clipboard | |
set clipboard=unnamedplus | |
"" Vdebug | |
let g:vdebug_options= { | |
\ "port" : 9000, | |
\ "server" : '', | |
\ "timeout" : 20, | |
\ "on_close" : 'detach', | |
\ "break_on_open" : 0, | |
\ "ide_key" : '', | |
\ "path_maps" : {}, | |
\ "debug_window_level" : 0, | |
\ "debug_file_level" : 0, | |
\ "debug_file" : "", | |
\ "watch_window_style" : 'compact', | |
\ "marker_default" : '⬦', | |
\ "marker_closed_tree" : '▸', | |
\ "marker_open_tree" : '▾' | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment