refac(prog/nvim): improve lsp hotkeys

This commit is contained in:
Dmitriy Pleshevskiy 2022-05-03 23:36:13 +03:00
parent 095fe593fd
commit a3b91d1222

View file

@ -111,30 +111,28 @@ let g:NERDTreeGitStatusIndicatorMapCustom = {
let g:lsp_preview_max_width = 60
let g:lsp_diagnostics_float_cursor = 1
" if (executable('haskell-language-server-wrapper'))
" echom "Haskell lsp installed"
" au User lsp_setup call lsp#register_server({
" \ 'name': 'haskell-language-server-wrapper',
" \ 'cmd': {server_info->['haskell-language-server-wrapper', 'lsp']},
" \ 'whitelist': ['haskell'],
" \ })
" endif
if (executable('haskell-language-server-wrapper'))
echom "Haskell lsp installed"
au User lsp_setup call lsp#register_server({
\ 'name': 'haskell-language-server-wrapper',
\ 'cmd': {server_info->['haskell-language-server-wrapper', 'lsp']},
\ 'whitelist': ['haskell'],
\ })
endif
function! s:on_lsp_buffer_enabled() abort
setlocal omnifunc=lsp#complete
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> <leader>rn <plug>(lsp-rename)
"nmap <buffer> gt <plug>(lsp-type-definition)
nmap <buffer> <localleader>n <plug>(lsp-rename)
nmap <buffer> <localleader>a <plug>(lsp-code-action)
nmap <buffer> <localleader>h <plug>(lsp-signature-help)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K <plug>(lsp-hover)
nnoremap <buffer> <expr><c-f> lsp#scroll(+4)
nnoremap <buffer> <expr><c-d> lsp#scroll(-4)
" refer to doc to add more commands
endfunction