" 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. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by " other plugin before putting this into your config. 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 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 = '' 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