Vim: nvim compatibility; replaced OmniCpp with vim-lsp

This commit is contained in:
Thomas Kolb 2020-04-15 17:22:55 +02:00
parent 641feaaf4a
commit 0f237d5909
2 changed files with 43 additions and 28 deletions

View File

@ -1,12 +1,15 @@
set ts=2
set sw=2
set ts=4
set sw=4
set showcmd
set nofsync
set swapsync=
set incsearch
set hlsearch
set cursorline
if !has('nvim')
set swapsync=
endif
" Set up visible whitespace by default
set list
set listchars=tab:»-,trail:~,extends:>,precedes:<

View File

@ -1,33 +1,45 @@
" configure tags - add additional tags here or comment out not-used ones
set tags+=~/.vim/tags/cpp
set tags+=~/.vim/tags/gl
set tags+=~/.vim/tags/sdl
set tags+=~/.vim/tags/qt4
set tags+=~/.vim/tags/irrlicht
" build tags of your own project with F11
map <F11> :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
map <F10> :mksession! Session.vim \| wviminfo! viminfo<CR>
" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview
" for latex-suite
filetype plugin on
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
let g:Tex_ViewRule_dvi = 'okular'
let g:Tex_ViewRule_pdf = 'okular'
set modeline
set expandtab
set noexpandtab
set listchars+=precedes:<,extends:>
" Language Server
let g:lsp_signs_enabled = 1 " enable signs
let g:lsp_diagnostics_echo_cursor = 1 " enable echo under cursor when in normal mode
"if executable('pyls')
" " pip install python-language-server
" au User lsp_setup call lsp#register_server({
" \ 'name': 'pyls',
" \ 'cmd': {server_info->['pyls']},
" \ 'whitelist': ['python'],
" \ })
"endif
if executable('ghdl-ls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ghdl-ls',
\ 'cmd': {server_info->['ghdl-ls']},
\ 'whitelist': ['vhdl'],
\ })
endif
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
nmap <buffer> gd <plug>(lsp-definition)
nmap <buffer> <f2> <plug>(lsp-rename)
" refer to doc to add more commands
endfunction
augroup lsp_install
au!
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
augroup END