Skip to content

Instantly share code, notes, and snippets.

@haringsrob
Created March 1, 2017 16:20
Show Gist options
  • Save haringsrob/1ba71148258397129c94dbe96d55f89f to your computer and use it in GitHub Desktop.
Save haringsrob/1ba71148258397129c94dbe96d55f89f to your computer and use it in GitHub Desktop.
NeoVim as php IDE - Single file setup
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" : '▾'
\ }
@marulitua
Copy link

I am using this configuration but i got this error at the bottom of neovim.

{"jsonrpc": "2.0", "error": {"message": "ErrorException: file_get_co...t\\Loop\\run()\n#20 {main}", "data": null, "code": -32603}, "id": 0}

Is this configuration still work ?

@taoso
Copy link

taoso commented Apr 9, 2018

may be you would like to try the phpcd.vim

@lov3catch
Copy link

What about ctags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment