dotfiles/vim/lsp.vim

27 lines
835 B
VimL

" Default extensions
let g:coc_global_extensions = [
\ "coc-diagnostic",
\ "@yaegassy/coc-ruff", "@yaegassy/coc-pylsp", "@yaegassy/coc-mypy", "coc-clangd", "coc-rust-analyzer"
\ ]
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gD <Plug>(coc-implementation)
nmap <silent> 1gD <Plug>(coc-type-definition)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Using CocList
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
nnoremap <silent> <space>p :<C-u>CocListResume<CR>