Advertisement
Guest User

Untitled

a guest
Jun 10th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.89 KB | None | 0 0
  1. Plug 'prabirshrestha/asyncomplete.vim'
  2. Plug 'prabirshrestha/async.vim'
  3. Plug 'prabirshrestha/vim-lsp'
  4. Plug 'prabirshrestha/asyncomplete-lsp.vim'
  5.  
  6. if executable('clangd')
  7.     au User lsp_setup call lsp#register_server({
  8.         \ 'name': 'clangd',
  9.         \ 'cmd': {server_info->['clangd', '-background-index']},
  10.         \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
  11.         \ })
  12. endif
  13.  
  14. function! s:on_lsp_buffer_enabled() abort
  15.     setlocal omnifunc=lsp#complete
  16.     setlocal signcolumn=yes
  17.     if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
  18.     nmap <buffer> gd <plug>(lsp-definition)
  19.     nmap <buffer> <f2> <plug>(lsp-rename)
  20.     " refer to doc to add more commands
  21. endfunction
  22.  
  23. augroup lsp_install
  24.     au!
  25.     " call s:on_lsp_buffer_enabled only for languages that has the server registered.
  26.     autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
  27. augroup END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement