command ! - nargs=? Fold : call CocAction( 'fold ', )
" Add `:Fold` command to fold current buffer. command ! - nargs= 0 Format : call CocAction( 'format ') " Add `:Format` command to format current buffer. " Requires 'textDocument/selectionRange' support of language server. Nnoremap coc#float#has_scroll() ? coc#float#scroll( 1) : " \ " nnoremap coc#float#has_scroll() ? coc#float#scroll( 0) : " \ " inoremap coc#float#has_scroll() ? " \=coc#float#scroll(1) \ " : " \ " inoremap coc#float#has_scroll() ? " \=coc#float#scroll(0) \ " : " \ " vnoremap coc#float#has_scroll() ? coc#float#scroll( 1) : " \ " vnoremap coc#float#has_scroll() ? coc#float#scroll( 0) : " \ " endif " Use CTRL-S for selections ranges. " Remap and for scroll float windows/popups. " Map function and class text objects " NOTE: Requires 'textDocument.documentSymbol' support from the language server.
" Run the Code Lens action on the current line. " Apply AutoFix to problem on the current line. " Remap keys for applying codeAction to the current buffer. " Example: `aap` for current paragraph xmap a (coc -codeaction -selected) autocmd User CocJumpPlaceholder call CocActionAsync( 'showSignatureHelp ')Īugroup end " Applying codeAction to the selected region.
" Update signature help on jump placeholder. autocmd FileType typescript,json setl formatexpr = CocAction( 'formatSelected ') xmap f (coc -format -selected)Īugroup mygroup autocmd ! " Setup formatexpr specified filetype(s). autocmd CursorHold * silent call CocActionAsync( 'highlight ') expand( ' ')Įndif endfunction " Highlight the symbol and its references when holding the cursor. If ( index(, & filetype) >= 0)Įlse execute '! '. nnoremap K : call show_documentation() function ! s:show_documentation() " Use K to show documentation in preview window. \: " \u \\=coc#on_enter() \ " " Use `g` to navigate diagnostics " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. if has( 'nvim ')Įndif " Make auto-select the first completion item and notify coc.nvim to " format on enter, could be remapped by other vim plugin inoremap pumvisible() ? coc#_select_confirm() ') =~# '\s ' endfunction " Use to trigger completion.
Inoremap pumvisible() ? " \ " : " \ " function ! s:check_back_space() abort let col = col( '. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. " Recently vim can merge signcolumn and number column into one set signcolumn = number else set signcolumn =yesĮndif " Use tab for trigger completion with characters ahead and navigate. set shortmess += c " Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. set updatetime = 300 " Don't pass messages to |ins-completion-menu|. set cmdheight = 2 " Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable " delays and poor user experience. set nobackup set nowritebackup " Give more space for displaying messages. set hidden " Some servers have issues with backup files, see #649. " Set internal encoding of vim, not needed on neovim, since coc.nvim using some " unicode characters in the file autoload/float.vim set encoding =utf - 8 " TextEdit might fail if hidden is not set.