summaryrefslogtreecommitdiff
path: root/_config/200-lsp.vim
blob: e15602936d2f3dcd4ea9abbab3a48166163e78d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
UsePlugin 'vim-lsp'

let g:lsp_diagnostics_enabled = 1
let g:lsp_diagnostics_float_cursor = 1
let g:lsp_signs_enabled = 1         " enable signs
let g:lsp_diagnostics_echo_cursor = 1 " enable echo under cursor when in normal mode
" let g:lsp_ultisnips_integration = 1
" for debug
" let g:lsp_log_verbose = 1
" let g:lsp_log_file = expand('~/vim-lsp.log')
" let g:asyncomplete_log_file = expand('~/asyncomplete.log')

let g:lsp_settings = {
\  'efm-langserver': {
\    'disabled': 0,
\   }
\}

autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif

function! s:on_lsp_buffer_enabled() abort
    setlocal omnifunc=lsp#complete
    setlocal signcolumn=yes
    nmap <buffer> gd <plug>(lsp-definition)
    nmap <buffer> <f2> <plug>(lsp-rename)
    nmap <buffer> gD <plug>(lsp-references)
    nmap <buffer> K <plug>(lsp-hover)
    nmap <buffer> ]s <plug>(lsp-next-error)
    nmap <buffer> [s <plug>(lsp-previous-error)

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