diff --git a/.vimrc b/.vimrc index 4e6f58c..1db0ad1 100644 --- a/.vimrc +++ b/.vimrc @@ -135,29 +135,72 @@ call plug#end() """"""""""""""" " Coc + +" `neoclide/coc.nvim` {{{ let g:coc_global_extensions = [ + \'coc-dictionary', + \'coc-syntax', \'coc-eslint', \'coc-prettier', \'coc-tsserver', - \'coc-python', \'coc-html', \'coc-emmet', \'coc-css', \'coc-svg', \'coc-svelte', + \'coc-jedi', \'coc-json', - \'coc-markdownlint', \'coc-yaml', \'coc-snippets', - \'coc-clangd' + \'coc-clangd', + \'coc-bibtex' \] " Autocomplete -imap (coc-snippets-expand) -nn es :CocCommand snippets.editSnippets -ino pumvisible() ? "\" : - \ coc#refresh() -ino pumvisible() ? "\" : "k" +" + +" `coc-snippets` + +" TODO: is this block even necessary anymore? +" +" I use `coc-snippets-exand-jump` here as it is more flexible afaics +" As stated in the docs: +" `coc-snippets-expand` Expand snippet w/ current inserted text +" `coc-snippets-expand-jump` Expand snippet or jump to next placeholder of current snippet if possible + +" Use tab for expansion in every context Don't use it for jumping as +" expansions have priority over jumping (which is not always what you want) +" +" E.g. You don't want to expand `time` to say `12:05` upon ``bing to go +" from arguments to body in a function snippet + +inor + \ coc#pum#visible() ? coc#_select_confirm() : + \ coc#expandable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ "\" + +" Use and to move through suggestions +" Open suggestions if not yet open + +inor coc#pum#visible() ? coc#pum#next(1) : coc#refresh() + +" NOTE: As the followning interfered with digraphs, I replaced `coc#refresh` +" with `"\u\"` which afaik just does c-k when no completion menu is +" shown +" ``` +" inor coc#pum#visible() ? coc#pum#prev(1) : coc#refresh() +" ``` + +inor coc#pum#visible() ? coc#pum#prev(1) : "\u\" + +" NOTE: this is cutting text in visual mode, it is replaces `$VISUAL` on next +" expansion +" +" although I mapped it, I have yet to test this feature + +vmap (coc-snippets-select) + ino complete_info()["selected"] != "-1" ? "\" : "\u\" + " Show doccumentation fu! s:show_documentation() if (index(['vim','help'], &filetype) >= 0) @@ -166,13 +209,12 @@ fu! s:show_documentation() call CocAction('doHover') endif endfunction -nnoremap K :call show_documentation() +nn es :CocCommand snippets.editSnippets " Code action on cursor position nm do (coc-codeaction) -" Coc statusline -se statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} -" Prettier command +" Commands com! -nargs=0 Prettier :CocCommand prettier.formatFile +" }}} " `.../copilot` {{{