" ================================================== " COC configuration and mapping " ================================================== " Use `lp` and `ln` for navigate diagnostics nmap lp (coc-diagnostic-prev) nmap ln (coc-diagnostic-next) " Remap keys for gotos nmap ld (coc-definition) nmap lt (coc-type-definition) nmap li (coc-implementation) nmap lf (coc-references) " Remap for rename current word nmap lr (coc-rename) " Use K for show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() if &filetype == 'vim' execute 'h '.expand('') else call CocAction('doHover') endif endfunction augroup Coc " Highlight symbol under cursor on CursorHold autocmd CursorHold * silent call CocActionAsync('highlight') " Update signature help on jump placeholder autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') augroup END " See yank list nnoremap y :CocList -A --normal yank vmap fp (coc-format-selected) nmap fp (coc-format-selected) " Remap for rename current word nmap rn (coc-rename) " inoremap \ pumvisible() ? coc#_select_confirm() : \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : \ check_back_space() ? "\" : \ coc#refresh() function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction let g:coc_snippet_next = '' call coc#config('languageserver', { \ 'ccls': { \ 'command': 'ccls', \ 'trace.server': 'verbose', \ 'filetypes': ['c', 'cpp', 'objc', 'objcpp'] \ }, \ 'sorbet': { \ 'command': 'srb', \ 'args': ['tc', '--lsp', '--enable-all-experimental-lsp-features'], \ 'filetypes': ['ruby'], \ 'rootPatterns': ["sorbet/config"] \ } \}) call coc#config('eslint', { \ 'filetype': [ \ 'javascript', \ 'typescript', \ 'typescriptreact', \ 'typescript.tsx', \ 'vue' \ ] })