Add vim-lsp for Haskell goodness
This commit is contained in:
parent
360d1d4055
commit
e80e268527
1 changed files with 41 additions and 0 deletions
|
@ -107,6 +107,7 @@ let
|
|||
vim-hcl
|
||||
vim-ledger
|
||||
vim-lilypond
|
||||
vim-lsp
|
||||
vim-nix
|
||||
vim-orgmode
|
||||
vim-selinux
|
||||
|
@ -255,6 +256,46 @@ let
|
|||
au BufRead,BufNewFile Vagrantfile set filetype=ruby
|
||||
augroup END
|
||||
|
||||
" Haskell Language Server
|
||||
if executable('dhall-lsp-server')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'dhall-lsp',
|
||||
\ 'cmd': {server_info->['dhall-lsp-server']},
|
||||
\ 'allowlist': ['dhall'],
|
||||
\ })
|
||||
endif
|
||||
if executable('haskell-language-server-wrapper')
|
||||
au User lsp_setup call lsp#register_server({
|
||||
\ 'name': 'haskell-lsp',
|
||||
\ 'cmd': {server_info->['haskell-language-server-wrapper', '--lsp']},
|
||||
\ 'allowlist': ['haskell'],
|
||||
\ })
|
||||
endif
|
||||
|
||||
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> 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> [g <Plug>(lsp-previous-diagnostic)
|
||||
nmap <buffer> ]g <Plug>(lsp-next-diagnostic)
|
||||
nmap <buffer> K <plug>(lsp-hover)
|
||||
nmap <buffer> <leader>a <plug>(lsp-code-action)
|
||||
nmap <buffer> <leader>dd <plug>(lsp-document-diagnostics)
|
||||
|
||||
" 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
|
||||
|
||||
" Extra options
|
||||
${extraOptions}
|
||||
'';
|
||||
|
|
Loading…
Reference in a new issue