" Always show the signcolumn, otherwise it would shift the text each time " diagnostics appear/become resolved. if has("nvim-0.5.0") || has("patch-8.1.1564") " Recently vim can merge signcolumn and number column into one set signcolumn=number else set signcolumn=yes endif " Use tab for trigger completion with characters ahead and navigate. inoremap \ pumvisible() ? "\" : \ check_back_space() ? "\" : \ coc#refresh() inoremap pumvisible() ? "\" : "\" function! s:check_back_space() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction " Use to trigger completion. if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif " GoTo definition nmap gd (coc-definition) " Use for trigger snippet expand. imap (coc-snippets-expand) " Use F2 to rename a variable, e.g. nmap (coc-rename) let g:coc_global_extensions = [ \ 'coc-tsserver', \ 'coc-css', \ 'coc-go', \ 'coc-html', \ 'coc-prettier', \ 'coc-sh', \ 'coc-svelte', \ 'coc-pairs', \ 'coc-json', \ 'coc-snippets', \ 'coc-emmet', \ 'coc-highlight', \ 'coc-python', \ 'coc-emoji' \ ] " Use to confirm completion, `u` means break undo chain at current position. " Coc only does snippet and additional edit on confirm. inoremap pumvisible() ? "\" : "\u\" command! -nargs=0 Prettier :CocCommand prettier.formatFile " Use K to show documentation in preview window nnoremap K :call show_documentation() function! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) execute 'h '.expand('') else call CocAction('doHover') endif endfunction