54 lines
2.0 KiB
VimL
54 lines
2.0 KiB
VimL
Plug 'prabirshrestha/vim-lsp'
|
|
Plug 'prabirshrestha/asyncomplete.vim'
|
|
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
|
|
|
au User lsp_setup call lsp#register_server({
|
|
\ 'name': 'CiderLSP',
|
|
\ 'cmd': {server_info->[
|
|
\ '/google/bin/releases/cider/ciderlsp/ciderlsp',
|
|
\ '--tooltag=vim-lsp',
|
|
\ '--noforward_sync_responses',
|
|
\ '-hub_addr=blade:languageservices-staging'
|
|
\ ]},
|
|
\ 'allowlist': ['c', 'cpp', 'java', 'kotlin', 'proto', 'textproto', 'go', 'python', 'bzl', 'sql', 'yaml', 'googlesql', 'build', 'typescript', 'gcl', 'soy'],
|
|
\})
|
|
|
|
" Send async completion requests.
|
|
" WARNING: Might interfere with other completion plugins.
|
|
let g:lsp_async_completion = 1
|
|
|
|
" Enable UI for diagnostics
|
|
let g:lsp_signs_enabled = 1 " enable diagnostics signs in the gutter
|
|
let g:lsp_diagnostics_echo_cursor = 1 " enable echo under cursor when in normal mode
|
|
let g:lsp_diagnostics_float_cursor = 1 " enable floating window diagnostics
|
|
|
|
|
|
" Automatically show completion options
|
|
let g:asyncomplete_auto_popup = 1
|
|
|
|
function! s:on_lsp_buffer_enabled() abort
|
|
setlocal omnifunc=lsp#complete
|
|
setlocal signcolumn=yes
|
|
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
|
|
nmap <buffer> gd <plug>(lsp-definition)
|
|
nmap <buffer> gs <plug>(lsp-document-symbol-search)
|
|
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
|
|
nmap <buffer> gr <plug>(lsp-references)
|
|
nmap <buffer> gi <plug>(lsp-implementation)
|
|
nmap <buffer> gt <plug>(lsp-type-definition)
|
|
nmap <buffer> ga <plug>(lsp-code-action)
|
|
nmap <buffer> <leader>rn <plug>(lsp-rename)
|
|
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
|
|
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
|
|
inoremap <buffer> <expr><c-f> lsp#scroll(+4)
|
|
inoremap <buffer> <expr><c-d> lsp#scroll(-4)
|
|
|
|
nmap <buffer> L <plug>(lsp-hover)
|
|
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
|