Coc.nvim usage: Difference between revisions
From wikinotes
No edit summary |
|||
Line 9: | Line 9: | ||
CocCommand ${cmd} " run command provided by LSPs | CocCommand ${cmd} " run command provided by LSPs | ||
CocList commands " fuzzy search commands provided by LSPs | CocList commands " fuzzy search commands provided by LSPs | ||
</syntaxhighlight> | |||
Most COC functionality is exposed as Actions. | |||
<syntaxhighlight lang="vim"> | |||
" call action synchronously | |||
call CocAction('definitionHover') | |||
" call action asynchronously (with optional callback) | |||
function! s:DoAfterHover() | |||
echom 'hihihi' | |||
endfunc | |||
call CocActionAsync('definitionHover', function('s:DoAfterHover')) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Builtin Commands --> | </blockquote><!-- Builtin Commands --> |
Latest revision as of 21:55, 20 January 2022
Builtin Commands
CocInstall coc-pyright " install a language CocUninstall coc-pyright " uninstall a language CocOutline " tagbar-like outliner CocCommand ${cmd} " run command provided by LSPs CocList commands " fuzzy search commands provided by LSPsMost COC functionality is exposed as Actions.
" call action synchronously call CocAction('definitionHover') " call action asynchronously (with optional callback) function! s:DoAfterHover() echom 'hihihi' endfunc call CocActionAsync('definitionHover', function('s:DoAfterHover'))
Derived Commands
You can also bind commands mirroring the provided plug functions.
" ex: command CocRename silent exec "normal \<Plug>(coc-rename)" " Introspection (src, packages) CocDefinition " go to where variable assigned CocTypeDefinition " go to where variable type defined CocImplementation CocReferences " show uses of variable CocShowdocumentation " show docs " Formatting CocFormatBuffer " format file CocFormatSelected " format selection CocOrganizeImports " sort imports " Debugging CocInfo " show nvim, coc, lsp info CocOpenLog " show log