Add LSP to .vimrc

61e361b27cebf2783b700b6a703e1d875573092b
Alexis Sellier committed ago 1 parent 02ce3dbe
.vimrc +30 -0
300 300
  Plug 'vimwiki/vimwiki'
301 301
  Plug 'exu/pgsql.vim'
302 302
  Plug 'hail2u/vim-css3-syntax'
303 303
  Plug 'lervag/vimtex'
304 304
  Plug 'vim-scripts/gnupg.vim'
305 +
  Plug 'octol/vim-cpp-enhanced-highlight'
306 +
  Plug 'autozimu/LanguageClient-neovim', {'branch': 'next', 'do': 'bash install.sh', 'for': ['cpp', 'c', 'rust']}
307 +
  Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins', 'for': ['cpp', 'c', 'rust'] }
305 308
306 309
  call plug#end()
307 310
endif
308 311
312 +
"
313 +
" LSP
314 +
"
315 +
if has("nvim")
316 +
  let g:LanguageClient_serverCommands = {
317 +
      \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
318 +
      \ 'cpp': ['clangd'],
319 +
      \ }
320 +
endif
321 +
322 +
function! RunLanguageClient()
323 +
  if has("nvim")
324 +
    if has_key(g:LanguageClient_serverCommands, &filetype)
325 +
      call deoplete#enable()
326 +
      nnoremap <silent> <buffer> <C-]>     :call LanguageClient#textDocument_definition()<CR>
327 +
      nnoremap <silent> <buffer> <leader>d :call LanguageClient#textDocument_hover()<CR>
328 +
      nnoremap <silent> <buffer> <leader>c :call LanguageClient_contextMenu()<CR>
329 +
330 +
      let g:LanguageClient_diagnosticsSignsMax = 0
331 +
      let g:LanguageClient_hoverPreview = "Never"
332 +
      let g:LanguageClient_settingsPath = "settings.json"
333 +
    endif
334 +
  endif
335 +
endfunction
336 +
autocmd FileType * call RunLanguageClient()
337 +
338 +
309 339
" Use custom colors.
310 340
" This has to go after plugin initialization.
311 341
try
312 342
  colorscheme shady
313 343
catch