" ------------------- COC config ----------------------- set updatetime=300 set shortmess+=c set signcolumn=yes set nobackup set nowritebackup set cmdheight=2 " Use for trigger completion. inoremap coc#refresh() " Use for confirm completion, `u` means break undo chain at current position. " Coc only does snippet and additional edit on confirm. inoremap pumvisible() ? "\" : "\u\" " Use `[c` and `]c` for navigate diagnostics nmap [c (coc-diagnostic-prev) nmap ]c (coc-diagnostic-next) " Remap keys for gotos nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Remap for do codeAction of current line nmap ac (coc-codeaction) " Remap for do action format "nmap F (coc-action-format) "does not work nnoremap F :call CocAction('format') " Temporary command to run brittany in Haskell projects (ghcide does not support it yet) nnoremap af :r !brittany --write-mode=inplace %:p " Temporary command to run hlint in Haskell projects (ghcide does not support it yet) nnoremap al :AsyncRun hlint %:p " Show signature help autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') " 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 " Highlight symbol under cursor on CursorHold " autocmd CursorHold * silent call CocActionAsync('highlight') " Remap for rename current word nmap rn (coc-rename) " Show all diagnostics nnoremap a :CocList diagnostics " Find symbol of current document nnoremap o :CocList outline " Search workspace symbols nnoremap s :CocList -I symbols " Do default action for next item. nnoremap j :CocNext " Do default action for previous item. nnoremap k :CocPrev " Resume latest coc list nnoremap p :CocListResume nnoremap :call CocRequest('metals', 'workspace/executeCommand', { 'command': 'build-import' }) "nnoremap :ccl " COC Snippets " Use for trigger snippet expand. imap (coc-snippets-expand) " Use for select text for visual placeholder of snippet. vmap (coc-snippets-select) " Use for jump to next placeholder, it's default of coc.nvim let g:coc_snippet_next = '' " Use for jump to previous placeholder, it's default of coc.nvim let g:coc_snippet_prev = '' " Use for both expand and jump (make expand higher priority.) imap (coc-snippets-expand-jump)