- Use vim 8.1 or newer (in older version of vim,
tagstack
doesn’t work with the solution below)
- Install ALE https://github.com/dense-analysis/ale
- bind
Ctrl-]
to ALEGoToDefinition
using the following snippet of code
function ALELSPMappings()
let l:lsp_found=0
for l:linter in ale#linter#Get(&filetype) | if !empty(l:linter.lsp) | let l:lsp_found=1 | endif | endfor
if (l:lsp_found)
nnoremap <buffer> <C-]> :ALEGoToDefinition<CR>
nnoremap <buffer> <C-^> :ALEFindReferences<CR>
else
silent! unmap <buffer> <C-]>
silent! unmap <buffer> <C-^>
endif
endfunction
autocmd BufRead,FileType * call ALELSPMappings()
- install
tsserver
if you have not done so using npm
- Done.
No comments:
Post a Comment