coc.txt 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534
  1. *coc-nvim.txt* NodeJS client for Vim & Neovim.
  2. Version: 0.0.82
  3. Author: Qiming Zhao <chemzqm at gmail.com>
  4. License: Anti 996 license
  5. CONTENTS *coc-contents*
  6. Introduction |coc-introduction|
  7. Requirements |coc-requirements|
  8. Installation |coc-installation|
  9. Configuration |coc-configuration|
  10. LSP features |coc-lsp|
  11. Document |coc-document|
  12. Completion |coc-completion|
  13. Diagnostics |coc-diagnostics|
  14. Locations |coc-locations|
  15. Signature help |coc-signature|
  16. Format |coc-format|
  17. Code action |coc-code-actions|
  18. Document highlights |coc-document-highlights|
  19. Document color |coc-document-color|
  20. Snippets |coc-snippets|
  21. Workspace |coc-workspace|
  22. Cursors |coc-cursors|
  23. Outline |coc-outline|
  24. Call hierarchy |coc-callHierarchy|
  25. Semantic highlights |coc-semantic-highlights|
  26. Interface |coc-interface|
  27. Key mappings |coc-key-mappings|
  28. Variables |coc-variables|
  29. Buffer variables |coc-buffer-variables|
  30. Global variables |coc-global-variables|
  31. Functions |coc-functions|
  32. Commands |coc-commands|
  33. Autocmds |coc-autocmds|
  34. Highlights |coc-highlights|
  35. Tree |coc-tree|
  36. Tree mappings |coc-tree-mappings|
  37. Tree filter |coc-tree-filter|
  38. List |coc-list|
  39. List command |coc-list-command|
  40. List command options |coc-list-options|
  41. List configuration |coc-list-configuration|
  42. List mappings |coc-list-mappings|
  43. list sources |coc-list-sources|
  44. Dialog |coc-dialog|
  45. Dialog basic |coc-dialog-basic|
  46. Dialog confirm |coc-dialog-confirm|
  47. Dialog input |coc-dialog-input|
  48. Dialog menu |coc-dialog-menu|
  49. Dialog picker |coc-dialog-picker|
  50. Notification |coc-notification|
  51. Statusline integration |coc-status|
  52. Manual |coc-status-manual|
  53. Airline |coc-status-airline|
  54. Lightline |coc-status-lightline|
  55. FAQ |coc-faq|
  56. Changelog |coc-changelog|
  57. ==============================================================================
  58. INTRODUCTION *coc-introduction*
  59. Coc.nvim enhances your (Neo)Vim to match the user experience provided by
  60. VSCode through a rich extension ecosystem and implemented features of Language
  61. Server Protocol (3.16 for now).
  62. Some of its key features include:~
  63. - APIs compatible with both Vim8 and Neovim.
  64. - Loading VSCode-like extensions.
  65. - Configuring coc.nvim and its extensions with JSON configuration
  66. |coc-configuration|.
  67. - Configuring Language Servers that using Language Server Protocol (LSP)
  68. |coc-config-languageserver|.
  69. It is designed for best possible integration with other Vim plugins.
  70. Note: This plugin doesn't come with support for any specific language. You
  71. will need to install a coc.nvim extension or set up the language server by
  72. configuration.
  73. Note: multiple language servers for same document is allowed, but you should
  74. avoid configure same language server that already used by coc.nvim extension.
  75. Note: Automatic completion plugins can't play nicely together, you can disable
  76. automatic completion of coc.nvim through `"suggest.autoTrigger": "none"` (or
  77. `"suggest.autoTrigger": "trigger"`) in your configuration file.
  78. ==============================================================================
  79. REQUIREMENTS *coc-requirements*
  80. Neovim >= 0.4.0 or Vim >= 8.1.1719.
  81. NodeJS https://nodejs.org/ >= 12.12.0.
  82. Yarn https://yarnpkg.com/ required to build coc.nvim from typescript source
  83. code.
  84. ==============================================================================
  85. INSTALLATION *coc-installation*
  86. If you're using [vim-plug](https://github.com/junegunn/vim-plug), add this to
  87. your `init.vim` or `.vimrc`: >
  88. Plug 'neoclide/coc.nvim', {'branch': 'release'}
  89. <
  90. And run: >
  91. :PlugInstall
  92. For other plugin managers, make sure to use code from the release branch.
  93. To use Vim's native |packages| on Linux or MaxOS, use script like: >
  94. #!/bin/sh
  95. # for vim8
  96. mkdir -p ~/.vim/pack/coc/start
  97. cd ~/.vim/pack/coc/start
  98. curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv -
  99. vim -c 'helptags ~/.vim/pack/coc/start/doc|q'
  100. # for neovim
  101. mkdir -p ~/.local/share/nvim/site/pack/coc/start
  102. cd ~/.local/share/nvim/site/pack/coc/start
  103. curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz|tar xzfv -
  104. nvim -c 'helptags ~/.local/share/nvim/site/pack/coc/start|q'
  105. when using source code of coc.nvim, you'll have to install
  106. https://yarnpkg.com/ and run `yarn install` in project root of coc.nvim.
  107. ==============================================================================
  108. CONFIGURATION *coc-configuration*
  109. The configuration of coc.nvim is stored in file `coc-settings.json`.
  110. Command |:CocConfig| will open (create when necessary) a user settings
  111. file in the folder returned by |coc#util#get_config_home()|.
  112. To create a local configuration file for a specific workspace, use
  113. |:CocLocalConfig|.
  114. The global configuration file can be created in another directory by setting
  115. `g:coc_config_home` in your `.vimrc` or `init.vim`: >
  116. let g:coc_config_home = '/path/to/folder'
  117. The configuration files are all in JSON format (with comment supported), it's
  118. recommended to enable JSON completion and validation by install the `coc-json`
  119. extension: >
  120. :CocInstall coc-json
  121. <
  122. The user configuration can also be changed by |coc#config()|.
  123. Configurations are composed with builtin configurations and configurations
  124. contributed by coc extensions, see |coc-config| for builtin configurations.
  125. ==============================================================================
  126. LSP FEATURES *coc-lsp*
  127. All features (except for telemetry) of LSP 3.16 are supported, checkout
  128. the specification at
  129. https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/
  130. LSP features only works with attached document, see |coc-document-attached|.
  131. To check exists providers of current buffer, use command
  132. `:CocCommand document.checkBuffer` or |CocHasProvider()|.
  133. For historic reason, some features just works, but some are not.
  134. Features automatically work by default:~
  135. - Trigger completion |coc-completion|.
  136. - Diagnostics refresh |coc-diagnostics|.
  137. - Trigger signature help |coc-signature|.
  138. - Inlay hints (only works with some coc extensions, but not
  139. |coc-config-languageserver| yet).
  140. Note all features could be disabled/enabled by |coc-configuration| and some
  141. vim variables.
  142. Features require enabled by configuration:~
  143. - Semantic highlights |coc-semantic-highlights|.
  144. - Document color highlights |coc-document-color|.
  145. - Code lens, enabled by |coc-config-codeLens-enable|.
  146. - Linked editing, enabled by |coc-preferences-enableLinkedEditing|.
  147. - Format on type, enabled by |coc-preferences-formatOnType|
  148. - Format on save, enabled by |coc-preferences-formatOnSaveFiletypes|.
  149. Features requested by user:~
  150. - Locations related (including definitions, references etc.) |coc-locations|
  151. - Invoke code action |coc-code-actions|.
  152. - Show call hierarchy tree |coc-callHierarchy|.
  153. - Format, range format and on type format |coc-format|.
  154. - Highlight same symbol ranges |coc-document-highlights|.
  155. - Outline of document symbols |coc-outline| and |coc-list-symbols|.
  156. - Show hover information |CocAction('doHover')| and |CocAction('definitionHover')|.
  157. - Rename symbol under cursor |CocAction('rename')|.
  158. - Open link under cursor |CocAction('openlink')|.
  159. - Range selection |CocAction('rangeSelect').|
  160. - Create folds |CocAction('fold')|.
  161. For convenient, some actions have associated |coc-key-mappings| provided.
  162. Prefer |CocAction()| for more options.
  163. Features triggered by languageserver or extension:~
  164. - Show message notification.
  165. - Show message request.
  166. - Log message (use `:CocCommand workspace.showOutput` to show output).
  167. - Show document request.
  168. - Work done progress.
  169. To make coc.nvim provide LSP features for your languages, checkout
  170. https://github.com/neoclide/coc.nvim/wiki/Language-servers
  171. To debug issues with languageserver, checkout
  172. https://github.com/neoclide/coc.nvim/wiki/Debug-language-server
  173. ==============================================================================
  174. DOCUMENT *coc-document*
  175. An associated document is created on buffer create, and disposed on buffer
  176. unload.
  177. Attached document:~
  178. *coc-document-attached*
  179. An attached document means coc.nvim synchronize the lines of vim's buffer with
  180. associated document automatically.
  181. Only attached documents are synchronized with language servers and therefore
  182. LSP features could be provided for the attached buffer.
  183. The buffer may not be attached by following reasons:
  184. - The 'buftype' is neither <empty> nor 'acwrite'.
  185. - Buffer variable |b:coc_enabled| is `0`.
  186. - Byte length of buffer exceed |coc-preferences-maxFileSize|.
  187. - Buffer is used for command line window.
  188. Use |CocAction('ensureDocument')| or `:CocCommand document.checkBuffer` to
  189. check attached state of current buffer.
  190. Filetype map:~
  191. *coc-document-filetype*
  192. Some filetypes are mapped to others to match the languageId used by VSCode,
  193. including:
  194. - javascript.jsx -> javascriptreact
  195. - typescript.jsx -> typescriptreact
  196. - typescript.tsx -> typescriptreact
  197. - tex -> latex
  198. Use |g:coc_filetype_map| to create additional filetype maps.
  199. Use `:CocCommand document.echoFiletype` to echo mapped filetype of current
  200. document.
  201. Note make sure use mapped filetypes for configurations that expect filetypes.
  202. ==============================================================================
  203. COMPLETION *coc-completion*
  204. The builtin completion of vim is no longer used, the default completion
  205. behavior works like VSCode:
  206. - Completion is automatically triggered by default.
  207. - Item selection is enabled by default, use |coc-config-suggest-noselect| to
  208. disable default selection.
  209. - When selection enabled and no preselect item exists, recent used item that
  210. matched will be selected by default.
  211. - Snippet and additional edits only work after confirm completion.
  212. - 'completeopt' is not used and APIs of builtin popupmenu not work.
  213. Default Key-mappings:~
  214. To make the completion work like builtin completion without configuration,
  215. following key-mappings are used when the {lhs} is not mapped:
  216. Use <C-n>, <C-p>, <up> and <down> to navigate completion list: >
  217. inoremap <silent><expr> <C-n> coc#pum#visible() ? coc#pum#next(1) : "\<C-n>"
  218. inoremap <silent><expr> <C-p> coc#pum#visible() ? coc#pum#prev(1) : "\<C-n>"
  219. inoremap <silent><expr> <down> coc#pum#visible() ? coc#pum#next(0) : "\<down>"
  220. inoremap <silent><expr> <up> coc#pum#visible() ? coc#pum#prev(0) : "\<up>"
  221. <
  222. Use <PageDown> and <PageUp> to scroll: >
  223. inoremap <silent><expr> <PageDown> coc#pum#visible() ? coc#pum#scroll(1) : "\<PageDown>"
  224. inoremap <silent><expr> <PageUp> coc#pum#visible() ? coc#pum#scroll(0) : "\<PageUp>"
  225. <
  226. Use <C-e> and <C-y> to cancel and confirm completion: >
  227. inoremap <silent><expr> <C-e> coc#pum#visible() ? coc#pum#cancel() : "\<C-e>"
  228. inoremap <silent><expr> <C-y> coc#pum#visible() ? coc#pum#confirm() : "\<C-y>"
  229. Note: <CR> and <Tab> are not remapped by coc.nvim.
  230. >
  231. Related variables:~
  232. - Disable completion for buffer: |b:coc_suggest_disable|
  233. - Disable specific sources for buffer: |b:coc_disabled_sources|
  234. - Disable words for trigger completion: |b:coc_suggest_blacklist|
  235. - Add additional keyword characters: |b:coc_additional_keywords|
  236. Related functions:~
  237. - Trigger completion with options: |coc#start()|.
  238. - Trigger completion refresh: |coc#refresh()|.
  239. - Select and confirm completion: |coc#_select_confirm()|.
  240. - Check if customized popupmenu is visible: |coc#pum#visible()|.
  241. - Select next complete item: |coc#pum#next()|.
  242. - Select previous complete item: |coc#pum#prev()|.
  243. - Cancel completion and reset trigger text: |coc#pum#cancel()|.
  244. - Confirm completion: |coc#pum#confirm()|.
  245. - Close the popupmenu only: |coc#pum#stop()|.
  246. - Get information of the popupmenu: |coc#pum#info()|.
  247. - Select specific complete item: |coc#pum#select()|.
  248. - Insert word of selected item and finish completion: |coc#pum#insert()|.
  249. - Scroll popupmenu: |coc#pum#scroll()|.
  250. Customize completion:~
  251. Use |coc-config-suggest| to change behavior of completion.
  252. Use 'pumwidth' for configure minimal width of popupmenu and 'pumheight'
  253. for maximum height.
  254. Related Highlight groups:
  255. |CocPum| for highlight groups of customized pum.
  256. |CocSymbol| for kind icons.
  257. |CocMenuSel| for background highlight of selected item.
  258. Note: background, border and winblend are configured by
  259. |coc-config-suggest-floatConfig|.
  260. Example user key-mappings:~
  261. *coc-completion-example*
  262. Note: use command `:verbose imap` to check current insert
  263. key-mappings when your key-mappings not work.
  264. Use <tab> and <S-tab> to navigate completion list: >
  265. function! s:check_back_space() abort
  266. let col = col('.') - 1
  267. return !col || getline('.')[col - 1] =~ '\s'
  268. endfunction
  269. " Insert <tab> when previous text is space, refresh completion if not.
  270. inoremap <silent><expr> <TAB>
  271. \ coc#pum#visible() ? coc#pum#next(1):
  272. \ <SID>check_back_space() ? "\<Tab>" :
  273. \ coc#refresh()
  274. inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
  275. Use <c-space> to trigger completion: >
  276. if has('nvim')
  277. inoremap <silent><expr> <c-space> coc#refresh()
  278. else
  279. inoremap <silent><expr> <c-@> coc#refresh()
  280. endif
  281. <
  282. Use <CR> to confirm completion, use: >
  283. inoremap <expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<CR>"
  284. <
  285. To make <CR> to confirm selection of selected complete item or notify coc.nvim
  286. to format on enter, use: >
  287. inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm()
  288. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  289. Map <tab> for trigger completion, completion confirm, snippet expand and jump
  290. like VSCode: >
  291. inoremap <silent><expr> <TAB>
  292. \ coc#pum#visible() ? coc#_select_confirm() :
  293. \ coc#expandableOrJumpable() ?
  294. \ "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
  295. \ <SID>check_back_space() ? "\<TAB>" :
  296. \ coc#refresh()
  297. function! s:check_back_space() abort
  298. let col = col('.') - 1
  299. return !col || getline('.')[col - 1] =~# '\s'
  300. endfunction
  301. let g:coc_snippet_next = '<tab>'
  302. <
  303. Note: the `coc-snippets` extension is required for this to work.
  304. ==============================================================================
  305. DIAGNOSTICS SUPPORT *coc-diagnostics*
  306. Diagnostics of coc.nvim are automatically refreshed to UI by default, checkout
  307. |coc-config-diagnostic| for available configurations.
  308. Note most language servers only send diagnostics for opened buffers for
  309. performance reason, some lint tools could provide diagnostics for all files in
  310. workspace.
  311. Note pull diagnostics feature is added in LSP 3.17, which is not available
  312. yet.
  313. Changes on diagnostics refresh~
  314. - Add highlights for diagnostic ranges and virtual text (when enabled on
  315. neovim with virtual text support), see |coc-highlights-diagnostics|.
  316. - Add diagnostic signs to 'signcolumn', use `set signcolumn=yes` to avoid
  317. unnecessary UI refresh.
  318. - Update variable |b:coc_diagnostic_info|.
  319. - Refresh related |location-list| which was opened by |:CocDiagnostics|.
  320. Diagnostics are not refreshed when buffer is hidden, and refresh on insert
  321. mode is disabled by default.
  322. Diagnostics highlights:~
  323. See |coc-highlights-diagnostics|.
  324. Enable and disable diagnostics~
  325. Use |coc-config-diagnostic-enable| to toggle diagnostics feature.
  326. Use |CocAction('diagnosticToggle')| for enable/disable diagnostics of current
  327. buffer.
  328. Show diagnostic messages~
  329. Diagnostic messages would be automatically shown/hide when the diagnostics
  330. under cursor position changed (use float window/popup when possible) by
  331. default.
  332. To manually refresh diagnostics messages, use |<Plug>(coc-diagnostic-info)|
  333. and |CocAction('diagnosticPreview')|.
  334. Jump between diagnostics~
  335. Use key-mappings:
  336. |<Plug>(coc-diagnostic-next)| jump to next diagnostic.
  337. |<Plug>(coc-diagnostic-prev)| jump to previous diagnostic.
  338. |<Plug>(coc-diagnostic-next-error)| jump to next error.
  339. |<Plug>(coc-diagnostic-prev-error)| jump to previous error.
  340. Check all diagnostics~
  341. Use |coc-list-diagnostics| to open |coc-list| with all available diagnostics.
  342. Use API |CocAction('diagnosticList')| to get list of all diagnostics.
  343. ==============================================================================
  344. LOCATIONS SUPPORT *coc-locations*
  345. There're different kinds of locations, including "definitions", "declarations",
  346. "implementations", "typeDefinitions" and "references", the languageserver used
  347. by current document may support some of them.
  348. Key-mappings for invoke locations request~
  349. - |<plug>(coc-definition)|
  350. - |<plug>(coc-declaration)|
  351. - |<plug>(coc-implementation)|
  352. - |<plug>(coc-type-definition)|
  353. - |<plug>(coc-references)|
  354. - |<plug>(coc-references-used)|
  355. Error will be shown when the buffer not attached |coc-document-attached|.
  356. Location jump behavior~
  357. When there's only one location returned, the location is opened by command
  358. specified by |coc-preferences-jumpCommand| ("edit" by default), context mark
  359. is added by |m'|, so you can jump back previous location by <C-o>.
  360. When multiple locations returned, |coc-list-location| is opened for preview
  361. and other further actions.
  362. To use |coc-list-location| for single location as well, use
  363. |coc-locations-api| (instead key-mappings provided by coc.nvim).
  364. To change default options of |coc-list-location| or use other plugin for
  365. list of locations, see |g:coc_enable_locationlist|.
  366. To use vim's quickfix for locations, use configuration
  367. |coc-preferences-useQuickfixForLocations|.
  368. To use vim's tag list for definitions, use |CocTagFunc()|.
  369. *coc-locations-api*
  370. Related APIs~
  371. APIs for jump locations:
  372. - Jump to definition locations |CocAction('jumpDefinition')|.
  373. - Jump to declaration locations |CocAction('jumpDeclaration')|.
  374. - Jump to implementation locations |CocAction('jumpImplementation')|.
  375. - Jump to type definition locations |CocAction('jumpTypeDefinition')|.
  376. - Jump to references |CocAction('jumpReferences')| and |CocAction('jumpUsed')|.
  377. APIs for get location list:
  378. - |CocAction('definitions')|
  379. - |CocAction('declarations')|
  380. - |CocAction('implementations')|
  381. - |CocAction('typeDefinitions')|
  382. - |CocAction('references')|
  383. Send custom locations request to languageserver:
  384. - |CocLocations()|
  385. - |CocLocationsAsync()|
  386. ==============================================================================
  387. SIGNATURE HELP *coc-signature*
  388. Signature help of function is automatically triggered by default(when user
  389. type trigger characters defined by the provider), which will use float
  390. window/popup to show the signature messages when possible.
  391. Use |CocAction('showSignatureHelp')| to trigger signature help manually.
  392. Note error will not be thrown when provider not exists or nothing returned
  393. from languageserver, use `:CocCommand document.checkBuffer` to check provider
  394. state of current buffer.
  395. Use |coc-config-signature| to change default signature help behavior.
  396. ==============================================================================
  397. FORMAT *coc-format*
  398. There're various ways to format document.
  399. Format full document:~
  400. Use |CocAction('format')|, you can create a command like: >
  401. command! -nargs=0 Format :call CocActionAsync('format')
  402. <
  403. to format current buffer.
  404. Format on type:~
  405. Enable format when insert specific characters by configurations:
  406. - |coc-preferences-formatOnType|
  407. - |coc-preferences-formatOnTypeFiletypes|
  408. requires `onTypeEdit` provider |CocHasProvider|.
  409. Format selected code:~
  410. Use 'formatexpr' for specific filetypes: >
  411. autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  412. So that |gq| could works for format range of lines.
  413. >
  414. Setup visual mode and operator key-mappings: >
  415. xmap <leader>f <Plug>(coc-format-selected)
  416. nmap <leader>f <Plug>(coc-format-selected)
  417. <
  418. Format on save:~
  419. Use configuration |coc-preferences-formatOnSaveFiletypes|.
  420. Or create |BufWritePre| autocmd like: >
  421. autocmd BufWritePre * call CocAction('format')
  422. <
  423. Note avoid use |CocActionAsync| with |BufWritePre|.
  424. Format on enter:~
  425. Use |coc#on_enter()| is required to notify coc.nvim the press on enter key.
  426. Configure |coc-preferences-bracketEnterImprove|
  427. ==============================================================================
  428. CODE ACTION *coc-code-actions*
  429. Code actions are used for make some specific code changes.
  430. There're different kinds of code actions:
  431. - `quickfix` used for fix diagnostic(s).
  432. - `refactor` used for code refactor.
  433. - `source` code actions apply to the entire file.
  434. - `organizeImport` organize import statements of current document.
  435. Invoke code action~
  436. To fix diagnostic at current line, use |<plug>(coc-fix-current)|.
  437. Key-mappings for choose code action:~
  438. - |<plug>(coc-codeaction-cursor)|
  439. - |<plug>(coc-codeaction-line)|
  440. - |<plug>(coc-codeaction)|
  441. - |<plug>(coc-codeaction-selected)|
  442. |coc-dialog-menu| would be shown for pick specific code action.
  443. To invoke organize import action, use command like:
  444. >
  445. command! -nargs=0 OR :call CocAction('runCommand',
  446. \ 'editor.action.organizeImport')
  447. Related APIs~
  448. - |CocAction('codeActions')|
  449. - |CocAction('organizeImport')|
  450. - |CocAction('fixAll')|
  451. - |CocAction('quickfixes')|
  452. - |CocAction('doCodeAction')|
  453. - |CocAction('doQuickfix')|
  454. - |CocAction('codeActionRange')|
  455. ==============================================================================
  456. DOCUMENT HIGHLIGHTS *coc-document-highlights*
  457. Document highlights is used for highlight same symbols of current document
  458. under cusor.
  459. To enable highlight on CursorHold, create an autocmd like this: >
  460. autocmd CursorHold * silent call CocActionAsync('highlight')
  461. <
  462. Checkout |coc-highlights-document| for related highlight groups.
  463. Note error will not be thrown when provider not exists or nothing returned
  464. from languageserver with |CocAction('highlight')|
  465. Install `coc-highlight` extension if you want to highlight same words under
  466. cursor without languageserver support.
  467. To jump between previous/next symbol position, use
  468. `:CocCommand document.jumpToPrevSymbol` and
  469. `:CocCommand document.jumpToNextSymbol`
  470. ==============================================================================
  471. DOCUMENT COLOR *coc-document-color*
  472. Document colors added color highlights to your documents. To enable document
  473. color highlights, use ||coc-config-colors-filetypes||.
  474. Install `coc-highlights` to provide document color highlights for all
  475. filetypes.
  476. To pick a color from system color picker, use |CocAction('pickColor')| or
  477. choose `editor.action.pickColor` from |:CocCommand|.
  478. Note: may not work on your system.
  479. To change color presentation, use |CocAction('colorPresentation')| or choose
  480. `editor.action.colorPresentation` from |:CocCommand|.
  481. ==============================================================================
  482. SNIPPETS SUPPORT *coc-snippets*
  483. Snippets engine of coc.nvim support both VSCode snippets and ultisnips
  484. snippets format.
  485. The complete item with snippet format has label ends with `~` by default.
  486. Select the complete item and confirm the completion by |coc#pum#confirm()| to
  487. expand the snippet.
  488. A snippet session would be deactivated under the following conditions:
  489. - |InsertEnter| triggered outside snippet.
  490. - Jump to final placeholder.
  491. - Content change detected after snippet.
  492. - Content changed in a snippet outside placeholder (except for deletion of
  493. plain text).
  494. To load and expand custom snippets, install `coc-snippets` extension is
  495. recommended.
  496. Related configurations:~
  497. - |g:coc_snippet_prev|
  498. - |g:coc_snippet_next|
  499. - |coc-config-suggest-snippetIndicator|
  500. - |coc-config-suggest-preferCompleteThanJumpPlaceholder|
  501. - |coc-preferences-snippetStatusText|
  502. - |coc-preferences-snippetHighlight|
  503. Related functions:~
  504. - |coc#snippet#next()|
  505. - |coc#snippet#prev()|
  506. - |coc#expandable()|
  507. - |coc#jumpable()|
  508. - |coc#expandableOrJumpable()|
  509. Related variables, highlights and autocmds:~
  510. - |b:coc_snippet_active|
  511. - |CocSnippetVisual|
  512. - |CocJumpPlaceholder|
  513. ==============================================================================
  514. WROKSPACE SUPPORT *coc-workspace*
  515. Workspace folders~
  516. Unlike VSCode, workspace folders are resolved from filepath after buffer
  517. creation.
  518. A list of file/folder names is used for resolve workspace folder, the patterns
  519. could comes from:
  520. - |b:coc_root_patterns|
  521. - `rootPatterns` field of configured language server.
  522. - `rootPatterns` contributions from coc extensions.
  523. - |coc-preferences-rootPatterns|
  524. Workspace folder is resolved from cwd of vim first and then from top directory
  525. to the parent directory of current filepath, when workspace folder not
  526. resolved, current working directory is used if it's parent folder of current
  527. buffer. Configurations are provided to change the default behavior:
  528. - |coc-config-workspace-ignoredFiletypes|
  529. - |coc-config-workspace-ignoredFolders|
  530. - |coc-config-workspace-bottomUpFiletypes|
  531. - |coc-config-workspace-workspaceFolderCheckCwd|
  532. - |coc-config-workspace-workspaceFolderFallbackCwd|
  533. Note for performance reason, user's home directory would never considered as
  534. workspace folder, which also means the languageserver that requires workspace
  535. folder may not work when you start vim from home directory.
  536. To preserve workspace folders across vim session, |g:WorkspaceFolders| is
  537. provided.
  538. To manage current workspace folders, use |coc-list-folders|
  539. To get related root patterns of current buffer, use |coc#util#root_patterns()|
  540. Use `:CocCommand workspace.workspaceFolders` to echo current workspaceFolders.
  541. Workspace edit~
  542. Workspace edit is used to apply changes for multiple buffers(and files), the
  543. edit could includes document edits and file operations (including file create,
  544. file/directory delete and file/directory rename).
  545. When the edit failed to apply, coc.nvim will revert the changes (including
  546. document edits and file operations) that previous made.
  547. Files not loaded would be loaded by `tab drop` command, configured by
  548. |coc-config-workspace-openResourceCommand|.
  549. To undo and redo workspace edit just applied, use command
  550. `:CocCommand workspace.undo` and `:CocCommand workspace.redo`
  551. To inspect previous workspace edit, use command
  552. `:CocCommand workspace.inspectEdit`, in opened buffer, use <CR> for jump to
  553. change position under cursor.
  554. ==============================================================================
  555. CURSORS SUPPORT *coc-cursors*
  556. Multiple cursors supported is added to allow edit multiple locations at once.
  557. Cursors session could be started by following ways:
  558. - Use command `:CocCommand document.renameCurrentWord` to rename variable
  559. under cursor.
  560. - Use |<plug>(coc-refactor)| to open refactor buffer.
  561. - Use |:CocSearch| to open searched locations.
  562. - Use cursors related key-mappings to add text range, including
  563. |<plug>(coc-cursors-operator)|, |<Plug>(coc-cursors-word)|,
  564. |<Plug>(coc-cursors-position)| and |<plug>(coc-cursors-range)|
  565. - Ranges added by command `editor.action.addRanges` from coc extensions.
  566. Default key-mappings when cursors activated:
  567. - <esc> cancel cursors session.
  568. - <C-n> jump to next cursors range.
  569. - <C-p> jump to previous cursors range.
  570. Use |coc-config-cursors| to change cursors related key-mappings.
  571. Use highlight group |CocCursorRange| to change default range highlight.
  572. Use |b:coc_cursors_activated| to check if cursors session is enabled.
  573. ==============================================================================
  574. SYMBOLS OUTLINE *coc-outline*
  575. Outline is a split window with current document symbols rendered as
  576. |coc-tree|.
  577. To show and hide outline of current window, use |CocAction('showOutline')| and
  578. |CocAction('hideOutline')|.
  579. Outline view has Window variable `cocViewId` set to `OUTLINE`.
  580. Following outline features are supported:
  581. - Start fuzzy filter by |coc-config-tree-key-activeFilter|.
  582. - Automatic update after document change.
  583. - Automatic reload when buffer in current window changed.
  584. - Automatic follow cursor position by default.
  585. - Different filter modes that can be changed on the fly
  586. |coc-config-outline-switchSortKey|.
  587. Note: outline would try to reload document symbols after 500ms when provider
  588. not registered, which avoid the necessary to check provider existence.
  589. Checkout |coc-config-tree| and |coc-config-outline| for available
  590. configurations.
  591. Checkout |CocTree| and |CocSymbol| for customize highlights.
  592. Use configuration `"suggest.completionItemKindLabels"` for custom icons.
  593. To show outline for each tab automatically, use |autocmd|:
  594. >
  595. autocmd VimEnter,Tabnew *
  596. \ if empty(&buftype) | call CocActionAsync('showOutline', 1) | endif
  597. <
  598. To close outline when it's the last window automatically, use
  599. |autocmd| like:
  600. >
  601. autocmd BufEnter * call CheckOutline()
  602. function! CheckOutline() abort
  603. if &filetype ==# 'coctree' && winnr('$') == 1
  604. if tabpagenr('$') != 1
  605. close
  606. else
  607. bdelete
  608. endif
  609. endif
  610. endfunction
  611. <
  612. Create a key-mapping to toggle outline, like:
  613. >
  614. nnoremap <silent><nowait> <space>o :call ToggleOutline()<CR>
  615. function! ToggleOutline() abort
  616. let winid = coc#window#find('cocViewId', 'OUTLINE')
  617. if winid == -1
  618. call CocActionAsync('showOutline', 1)
  619. else
  620. call coc#window#close(winid)
  621. endif
  622. endfunction
  623. <
  624. ==============================================================================
  625. CALL HIERARCHY *coc-callHierarchy*
  626. A call hierarchy is a splited |coc-tree| with locations for incoming or
  627. outgoing calls of current function.
  628. Call hierarchy window is opend by |CocAction('showIncomingCalls')| and
  629. |CocAction('showOutgoingCalls')|.
  630. Call hierarchy is configured by |CocSymbol|, |coc-config-callHierarchy| and
  631. |coc-config-tree|.
  632. Related ranges are highlighted with |CocSelectedRange| highlight group in
  633. opend buffer.
  634. |coc-dialog-menu| could be invoked by |coc-config-tree-key-actions|.
  635. Available actions:
  636. - Dismiss.
  637. - Open in new tab.
  638. - Show Incoming Calls.
  639. - Show Outgoing Calls.
  640. Use <CR> in call hierarchy tree to open location in original window.
  641. ==============================================================================
  642. SEMANTIC HIGHLIGHTS *coc-semantic-highlights*
  643. Semantic tokens are used to add additional color information to a file that
  644. depends on language specific symbol information.
  645. Use |coc-config-semanticTokens-filetypes| to enable semantic tokens highlights.
  646. Use `:CocCommand semanticTokens.checkCurrent` to check semantic highlight
  647. information with current buffer.
  648. To create custom highlights for symbol under cursor, follow these steps:
  649. - Inspect semantic token by
  650. >
  651. :CocCommand semanticTokens.inspect
  652. <
  653. to check token type and token modifiers with current symbol.
  654. - Create new highlight group by |highlight|, for example:
  655. >
  656. :hi link CocSemDeclarationVariable MoreMsg
  657. <
  658. - Refresh semantic highlight of current buffer by:
  659. >
  660. :CocCommand semanticTokens.refreshCurrent
  661. <
  662. See |CocSem| to customize semantic token highlight groups.
  663. See |coc-config-semanticTokens| for related configurations.
  664. ==============================================================================
  665. INTERFACE *coc-interface*
  666. ------------------------------------------------------------------------------
  667. Key mappings *coc-key-mappings*
  668. There're some cases that local key-mappings are enabled for current buffer.
  669. Snippet jump key-mappings when snippet is activated:
  670. |g:coc_snippet_prev| and |g:coc_snippet_next|.
  671. Cursor jump and cancel key-mappings when cursors is activated
  672. |coc-config-cursors|.
  673. Dialog key-mappings for confirm and cancel dialog window
  674. |coc-config-dialog|.
  675. Key-mappings for |CocList| buffer: |coc-list-mappings|.
  676. Note: Use |:verbose| command to check key-mappings that taking effect.
  677. Note: Use 'noremap' with <Plug> will make the key-mapping not work at all.
  678. Note: <Plug> key-mappings are provided for convenient, use |CocActionAsync()| or
  679. |CocAction()| for more options.
  680. Normal mode key-mappings:~
  681. *<plug>(coc-diagnostic-info)* Show diagnostic message of current position by
  682. invoke |CocAction('diagnosticInfo')|
  683. *<plug>(coc-diagnostic-next)* Jump to next diagnostic position.
  684. *<plug>(coc-diagnostic-prev)* Jump to previous diagnostic position.
  685. *<plug>(coc-diagnostic-next-error)* Jump to next diagnostic error position.
  686. *<plug>(coc-diagnostic-prev-error)* Jump to previous diagnostic error position.
  687. *<plug>(coc-definition)* Jump to definition(s) of current symbol by invoke
  688. |CocAction('jumpDefinition')|
  689. *<plug>(coc-declaration)* Jump to declaration(s) of current symbol by invoke
  690. |CocAction('jumpDeclaration')|
  691. *<plug>(coc-implementation)* Jump to implementation(s) of current symbol by
  692. invoke |CocAction('jumpImplementation')|
  693. *<plug>(coc-type-definition)* Jump to type definition(s) of current symbol by
  694. invoke |CocAction('jumpTypeDefinition')|
  695. *<plug>(coc-references)* Jump to references of current symbol by invoke
  696. |CocAction('jumpReferences')|
  697. *<plug>(coc-references-used)* Jump to references of current symbol exclude
  698. declarations.
  699. *<plug>(coc-format-selected)*
  700. Format selected range, works on both |visual-mode| and |normal-mode|,
  701. when used in normal mode, the selection works on the motion object.
  702. For example: >
  703. vmap <leader>p <Plug>(coc-format-selected)
  704. nmap <leader>p <Plug>(coc-format-selected)
  705. <
  706. makes `<leader>p` format the visually selected range, and you can use
  707. `<leader>pap` to format a paragraph.
  708. *<plug>(coc-format)* Format the whole buffer by invoke |CocAction('format')|
  709. *<plug>(coc-rename)* Rename symbol under cursor to a new word by invoke
  710. |CocAction('rename')|
  711. *<plug>(coc-refactor)* Open refactor window for refactor of current symbol by
  712. invoke |CocAction('refactor')|
  713. *<plug>(coc-command-repeat)* Repeat latest |CocCommand|.
  714. *<plug>(coc-codeaction)* Get and run code action(s) for current file, use
  715. |coc-codeaction-cursor| for same behavior as VSCode.
  716. *<plug>(coc-codeaction-line)* Get and run code action(s) for current line.
  717. *<plug>(coc-codeaction-cursor)* Get and run code action(s) using empty range
  718. at current cursor.
  719. *<plug>(coc-codeaction-selected)* Get and run code action(s) with the selected
  720. region. Works on both |visual-mode| and |normal-mode|.
  721. *<plug>(coc-openlink)* Open link under cursor by use |CocAction('openlink')|.
  722. *<plug>(coc-codelens-action)* Do command from codeLens of current line.
  723. *<plug>(coc-fix-current)* Try first quickfix action for diagnostics of current
  724. line.
  725. *<plug>(coc-float-hide)* Hide all float windows/popups created by coc.nvim.
  726. *<plug>(coc-float-jump)* Jump to first float window (neovim only), use
  727. |CTRL-W_p| for jump to previous window.
  728. *<plug>(coc-range-select)*
  729. Select next selection range.
  730. Works on both |visual-mode| and |normal-mode|.
  731. Note: requires selection ranges feature of language server.
  732. *<plug>(coc-funcobj-i)*
  733. Select inside function. Recommend mapping:
  734. Works on both |visual-mode| and |normal-mode|.
  735. >
  736. xmap if <Plug>(coc-funcobj-i)
  737. omap if <Plug>(coc-funcobj-i)
  738. <
  739. Note: Requires 'textDocument.documentSymbol' support from the language
  740. server.
  741. *<Plug>(coc-funcobj-a)*
  742. Select around function. Works on both |visual-mode| and
  743. |normal-mode|. Recommended mapping:
  744. >
  745. xmap af <Plug>(coc-funcobj-a)
  746. omap af <Plug>(coc-funcobj-a)
  747. <
  748. Note: Requires 'textDocument.documentSymbol' support from the language
  749. server.
  750. *<Plug>(coc-classobj-i)*
  751. Select inside class/struct/interface. Works on both |visual-mode| and
  752. |normal-mode|. Recommended mapping:
  753. >
  754. xmap ic <Plug>(coc-classobj-i)
  755. omap ic <Plug>(coc-classobj-i)
  756. <
  757. Note: Requires 'textDocument.documentSymbol' support from the language
  758. server.
  759. *<plug>(coc-classobj-a)*
  760. Select around class/struct/interface. Works on both |visual-mode| and
  761. |normal-mode|. Recommended mapping:
  762. >
  763. xmap ac <Plug>(coc-classobj-a)
  764. omap ac <Plug>(coc-classobj-a)
  765. <
  766. Note: Requires 'textDocument.documentSymbol' support from the language
  767. server.
  768. *<plug>(coc-cursors-operator)* Add text to cursors session by motion object.
  769. *<Plug>(coc-cursors-word)* Add current word to cursors session.
  770. *<Plug>(coc-cursors-position)* Add current position as empty range to cursors
  771. session.
  772. Visual mode key-mappings:~
  773. *<plug>(coc-range-select-backward)*
  774. Select previous selection range.
  775. Note: requires selection ranges feature of language server, like:
  776. coc-tsserver, coc-python
  777. *<plug>(coc-cursors-range)* Add selection to cursors session.
  778. ------------------------------------------------------------------------------
  779. VARIABLES *coc-variables*
  780. User defined variables:~
  781. ------------------------------------------------------------------------------
  782. Buffer variables *coc-buffer-variables*
  783. b:coc_enabled *b:coc_enabled*
  784. Set to `0` on buffer create if you don't want coc.nvim receive content
  785. from buffer. Normally used with |BufAdd| autocmd, example:
  786. >
  787. " Disable file with size > 1MB
  788. autocmd BufAdd * if getfsize(expand('<afile>')) > 1024*1024 |
  789. \ let b:coc_enabled=0 |
  790. \ endif
  791. <
  792. b:coc_root_patterns *b:coc_root_patterns*
  793. Root patterns used for resolving workspaceFolder for
  794. the current file, will be used instead of
  795. `"coc.preferences.rootPatterns"` setting. Example: >
  796. autocmd FileType python let b:coc_root_patterns =
  797. \ ['.git', '.env']
  798. <
  799. b:coc_suggest_disable *b:coc_suggest_disable*
  800. Disable completion support of current buffer. Example: >
  801. " Disable completion for python
  802. autocmd FileType python let b:coc_suggest_disable = 1
  803. b:coc_disabled_sources *b:coc_disabled_sources*
  804. Disabled completion sources of current buffer. Example:
  805. >
  806. let b:coc_disabled_sources = ['around', 'buffer', 'file']
  807. <
  808. b:coc_diagnostic_disable *b:coc_diagnostic_disable*
  809. Disable diagnostic support of current buffer.
  810. b:coc_suggest_blacklist *b:coc_suggest_blacklist*
  811. List of input words for which completion should not be triggered.
  812. Example: >
  813. " Disable completion for 'end' in lua files
  814. autocmd FileType lua let b:coc_suggest_blacklist = ["end"]
  815. b:coc_additional_keywords *b:coc_additional_keywords*
  816. Addition keyword characters for generate keywords. Example: >
  817. " Add keyword characters for css
  818. autocmd FileType css let b:coc_additional_keywords = ["-"]
  819. b:coc_trim_trailing_whitespace *b:coc_trim_trailing_whitespace*
  820. Trim trailing whitespace on a line, default `0`.
  821. Use by "FormattingOptions" send to the server.
  822. b:coc_trim_final_newlines *b:coc_trim_final_newlines*
  823. Trim all newlines after the final newline at the end of the file.
  824. Use by "FormattingOptions" send to the server.
  825. Other buffer options that affect document format: 'eol', 'shiftwidth'
  826. and 'expandtab'.
  827. Note: language server may not respect format options.
  828. ------------------------------------------------------------------------------
  829. Global variables *coc-global-variables*
  830. g:coc_disable_startup_warning *g:coc_disable_startup_warning*
  831. Disable possible warning on startup for old vim/node version.
  832. Default: 0
  833. g:coc_disable_uncaught_error *g:coc_disable_uncaught_error*
  834. Disable uncaught error messages from node process of coc.nvim.
  835. Default: 0
  836. g:coc_text_prop_offset *g:coc_text_prop_offset*
  837. Start |textprop| id offset of highlight namespaces on vim, change to
  838. other value to avoid conflict.
  839. Default: 1000
  840. g:coc_channel_timeout *g:coc_channel_timeout*
  841. Channel timeout in seconds for request to node client.
  842. Default: 30
  843. g:coc_disable_transparent_cursor *g:coc_disable_transparent_cursor*
  844. Disable transparent cursor when CocList is activated.
  845. Set it to `1` if you have issue with transparent
  846. cursor.
  847. Default: 0
  848. g:coc_start_at_startup *g:coc_start_at_startup*
  849. Start coc service on startup, use |CocStart| to start server when you
  850. set it to 0.
  851. Default: 1
  852. g:coc_global_extensions *g:coc_global_extensions*
  853. Global extension names to install when they aren't installed.
  854. >
  855. let g:coc_global_extensions = ['coc-json', 'coc-git']
  856. <
  857. Note: coc.nvim will try to install extensions that are not installed
  858. in this list after initialization.
  859. g:coc_uri_prefix_replace_patterns *g:coc_uri_prefix_replace_patterns*
  860. This map defines URI prefix replacements. This is useful in the case
  861. that an LSP requires code to adhere to a particular directory
  862. structure. For example, `/Users/myUser/workspace` can be mapped to
  863. `/home/myUser/workspace`.
  864. >
  865. let g:coc_uri_prefix_replace_patterns = {'/Users': '/home'}
  866. <
  867. g:coc_enable_locationlist *g:coc_enable_locationlist*
  868. Use location list of |CocList| when jump to locations.
  869. Set it to 0 when you need customize behavior of location jump by use
  870. |CocLocationsChange| and |g:coc_jump_locations|
  871. If you want use vim's quickfix list instead, add
  872. `"coc.preferences.useQuickfixForLocations": true` in your
  873. configuration file, this configuration would be ignored and no autocmd
  874. triggered.
  875. Default: 1
  876. g:coc_snippet_next *g:coc_snippet_next*
  877. Trigger key for going to the next snippet position, applied in insert
  878. and select mode.
  879. Only works when snippet session is activated.
  880. Default: <C-j>
  881. g:coc_snippet_prev *g:coc_snippet_prev*
  882. Trigger key for going to the previous snippet position, applied in
  883. insert and select mode.
  884. Only works when snippet session is activated.
  885. Default: <C-k>
  886. g:coc_filetype_map *g:coc_filetype_map*
  887. Map for document filetypes so the server could handle current document
  888. as another filetype, example: >
  889. let g:coc_filetype_map = {
  890. \ 'html.swig': 'html',
  891. \ 'wxss': 'css',
  892. \ }
  893. <
  894. Default: {}
  895. See |coc-document-filetype| for details.
  896. g:coc_selectmode_mapping *g:coc_selectmode_mapping*
  897. Add key mappings for making snippet select mode easier. >
  898. snoremap <silent> <BS> <c-g>c
  899. snoremap <silent> <DEL> <c-g>c
  900. snoremap <silent> <c-h> <c-g>c
  901. snoremap <c-r> <c-g>"_c<c-r>
  902. <
  903. Default: 1
  904. g:coc_node_path *g:coc_node_path*
  905. Path to node executable to start coc service, example: >
  906. let g:coc_node_path = '/usr/local/opt/node@12/bin/node'
  907. <
  908. Use this when coc has problems with your system node,
  909. Note: you can use `~` as home directory.
  910. g:coc_node_args *g:coc_node_args*
  911. Arguments passed to node when starting coc service from source code.
  912. Useful for starting coc in debug mode, example: >
  913. >
  914. let g:coc_node_args = ['--nolazy', '--inspect-brk=6045']
  915. <
  916. Default: []
  917. g:coc_status_error_sign *g:coc_status_error_sign*
  918. Error character used for statusline, default: `E`
  919. g:coc_status_warning_sign *g:coc_status_warning_sign*
  920. Warning character used for statusline, default: `W`
  921. g:coc_quickfix_open_command *g:coc_quickfix_open_command*
  922. Command used for open quickfix list. To jump fist position after
  923. quickfix list opend, you can use:
  924. >
  925. let g:coc_quickfix_open_command = 'copen|cfirst'
  926. <
  927. Default: |copen|
  928. g:node_client_debug *g:node_client_debug*
  929. Enable debug mode of node client for check rpc messages between vim
  930. and coc.nvim. Use environment variable $NODE_CLIENT_LOG_FILE to set
  931. the log file or get the log file after coc.nvim started.
  932. To open the log file, use command: >
  933. :call coc#client#open_log()
  934. <
  935. Default: `0`
  936. g:coc_config_home *g:coc_config_home*
  937. Configure the directory which will be used to look for
  938. user's `coc-settings.json`, default:
  939. Windows: `~/AppData/Local/nvim`
  940. Other: `~/.config/nvim`
  941. g:coc_data_home *g:coc_data_home*
  942. Configure the directory which will be used to for data
  943. files(extensions, mru and so on), default:
  944. Windows: `~/AppData/Local/coc`
  945. Other: `~/.config/coc`
  946. g:coc_terminal_height *g:coc_terminal_height*
  947. Height of terminal window, default `8`.
  948. g:coc_markdown_disabled_languages *g:coc_markdown_disabled_languages*
  949. Filetype list that should be disabled for highlight in markdown block,
  950. Example: >
  951. let g:coc_markdown_disabled_languages = ['html']
  952. g:coc_highlight_maximum_count *g:coc_highlight_maximum_count*
  953. When highlight items exceed maximum count, highlight items will be
  954. grouped and added by using |timer_start| for better user experience.
  955. Default `100`
  956. g:coc_default_semantic_highlight_groups *g:coc_default_semantic_highlight_groups*
  957. Create default semantic highlight groups for |coc-semantic-highlights|
  958. Default: `1`
  959. g:coc_max_treeview_width *g:coc_max_treeview_width*
  960. Maximum width of tree view when adjusted by auto width.
  961. Default: `40`
  962. g:coc_borderchars *g:coc_borderchars*
  963. Border characters used by border window, default to:
  964. >
  965. ['─', '│', '─', '│', '┌', '┐', '┘', '└']
  966. <
  967. Note: you may need special font like Nerd font to show them.
  968. g:coc_border_joinchars *g:coc_border_joinchars*
  969. Border join characters used by float window/popup, default to:
  970. >
  971. ['┬', '┤', '┴', '├']
  972. <
  973. Note: you may need special font like Nerd font to show them.
  974. g:coc_prompt_win_width *g:coc_prompt_win_width*
  975. Width of input prompt window, default `32`.
  976. *g:coc_notify*
  977. g:coc_notify_error_icon *g:coc_notify_error_icon*
  978. Error icon for notification, default to: 
  979. g:coc_notify_warning_icon *g:coc_notify_warning_icon*
  980. Warning icon for notification, default to: ⚠
  981. g:coc_notify_info_icon *g:coc_notify_info_icon*
  982. Info icon for notification, default to: 
  983. ------------------------------------------------------------------------------
  984. Some variables are provided by coc.nvim.
  985. g:WorkspaceFolders *g:WorkspaceFolders*
  986. Current workspace folders, used for restoring from a session file, add
  987. `set sessionoptions+=globals` to vimrc for restoring globals on
  988. session load.
  989. g:coc_jump_locations *g:coc_jump_locations*
  990. This variable would be set to jump locations when the
  991. |CocLocationsChange| autocmd is fired.
  992. Each location item contains:
  993. 'filename': full file path.
  994. 'lnum': line number (1 based).
  995. 'col': column number(1 based).
  996. 'text': line content of location.
  997. g:coc_process_pid *g:coc_process_pid*
  998. Process pid of coc.nvim service. If your vim doesn't kill coc.nvim
  999. process on exit, use:
  1000. >
  1001. autocmd VimLeavePre * if get(g:, 'coc_process_pid', 0)
  1002. \ | call system('kill -9 '.g:coc_process_pid) | endif
  1003. <
  1004. in your vimrc.
  1005. g:coc_service_initialized *g:coc_service_initialized*
  1006. Is `1` when coc.nvim initialized, used with autocmd |CocNvimInit|.
  1007. g:coc_status *g:coc_status*
  1008. Status string contributed by coc.nvim and extensions, used for status
  1009. line.
  1010. g:coc_last_float_win *g:coc_last_float_win*
  1011. Window id of latest created float/popup window.
  1012. g:coc_last_hover_message *g:coc_last_hover_message*
  1013. Last message echoed from `doHover`, can be used in statusline.
  1014. Note: not used when floating or preview window used for `doHover`.
  1015. b:coc_snippet_active *b:coc_snippet_active*
  1016. Is `1` when snippet session is activated, use |coc#jumpable| to check
  1017. if it's possible to jump placeholder.
  1018. b:coc_diagnostic_info *b:coc_diagnostic_info*
  1019. Diagnostic information of current buffer, the format would look like:
  1020. `{'error': 0, 'warning': 0, 'information': 0, 'hint':0}`
  1021. can be used to customize statusline. See |coc-status|.
  1022. b:coc_current_function *b:coc_current_function*
  1023. Function string that current cursor in.
  1024. Set `"coc.preferences.currentFunctionSymbolAutoUpdate": true`
  1025. in coc-settings.json to update it on CursorHold.
  1026. b:coc_cursors_activated *b:coc_cursors_activated*
  1027. Use expression `get(b:, 'coc_cursors_activated',0)` to check if
  1028. cursors session is activated for current buffer.
  1029. ------------------------------------------------------------------------------
  1030. FUNCTIONS *coc-functions*
  1031. Coc functions are normally used by user defined command/keymap or other
  1032. plugins.
  1033. Note: some functions only work after the coc service has been initialized.
  1034. To run a function on startup, use an autocmd like: >
  1035. autocmd User CocNvimInit call CocAction('runCommand',
  1036. \ 'tsserver.watchBuild')
  1037. <
  1038. coc#start([{option}]) *coc#start()*
  1039. Start completion with optional {option}. Option could contains:
  1040. - `source` specific completion source name.
  1041. Example: >
  1042. inoremap <silent> <C-w> <C-R>=coc#start({'source': 'word'})<CR>
  1043. <
  1044. Use `:CocList sources` to get available sources.
  1045. coc#refresh() *coc#refresh()*
  1046. Start or refresh completion at current cursor position, bind this to
  1047. 'imap' to trigger completion, example: >
  1048. inoremap <silent><expr> <c-space> coc#refresh()
  1049. coc#_select_confirm() *coc#_select_confirm()*
  1050. Select first completion item if no completion item is selected, then
  1051. confirm the completion.
  1052. coc#config({section}, {value}) *coc#config()*
  1053. Change user configuration, overwrite configurations from
  1054. user config file and default values. Example: >
  1055. call coc#config('coc.preferences', {
  1056. \ 'timeout': 1000,
  1057. \})
  1058. call coc#config('languageserver', {
  1059. \ 'ccls': {
  1060. \ "command": "ccls",
  1061. \ "trace.server": "verbose",
  1062. \ "filetypes": ["c", "cpp", "objc", "objcpp"]
  1063. \ }
  1064. \})
  1065. <
  1066. Note: this function can be called multiple times.
  1067. Note: this function can be called before coc.nvim started.
  1068. Note: this function can work alongside the user configuration file,
  1069. but it's not recommended to use both.
  1070. coc#add_extension({name}, ...) *coc#add_extension()*
  1071. Deprecated function for install extensions not exists.
  1072. Use |g:coc_global_extensions| variable instead.
  1073. Example: >
  1074. call coc#add_extension('coc-json', 'coc-tsserver', 'coc-rls')
  1075. <
  1076. This function can be called before service initialized.
  1077. This function can be called multiple times.
  1078. coc#add_command({id}, {command}, [{title}]) *coc#add_command()*
  1079. Add custom Vim command to commands list opened by
  1080. `:CocList commands` .
  1081. Example: >
  1082. call coc#add_command('mundoToggle', 'MundoToggle',
  1083. \ 'toggle mundo window')
  1084. <
  1085. coc#expandable() *coc#expandable()*
  1086. Check if a snippet is expandable at the current position.
  1087. Requires `coc-snippets` extension installed.
  1088. coc#jumpable() *coc#jumpable()*
  1089. Check if a snippet is jumpable at the current position.
  1090. coc#expandableOrJumpable() *coc#expandableOrJumpable()*
  1091. Check if a snippet is expandable or jumpable at the current position.
  1092. Requires `coc-snippets` extension installed.
  1093. coc#on_enter() *coc#on_enter()*
  1094. Notify coc.nvim that `<enter>` has been pressed.
  1095. Used for the format on type and improvement of brackets, example: >
  1096. " Confirm the completion when popupmenu is visible, insert <CR> and
  1097. " notify coc.nvim otherwise.
  1098. inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
  1099. \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
  1100. <
  1101. Note:to enable format on type, add ` "coc.preferences.formatOnType": true`
  1102. in your settings file.
  1103. coc#status() *coc#status()*
  1104. Return a status string that can be used in the status line, the status
  1105. includes diagnostic information from `b:coc_diagnostic_info` and
  1106. extension contributed statuses from `g:coc_status`. For statusline
  1107. integration, see |coc-status|
  1108. coc#util#api_version() *coc#util#api_version()*
  1109. Get coc.nvim's vim api version number, start from `1`.
  1110. coc#util#job_command() *coc#util#job_command()*
  1111. Get the job command used for starting the coc service.
  1112. coc#util#get_config_home() *coc#util#get_config_home()*
  1113. Get the config directory that contains the user's coc-settings.json.
  1114. coc#util#get_data_home() *coc#util#get_data_home()*
  1115. Get `coc` data directory.
  1116. coc#util#extension_root() *coc#util#extension_root()*
  1117. Return extensions root of coc.nvim.
  1118. coc#util#rebuild() *coc#util#rebuild()*
  1119. Run `npm rebuild` for all coc extensions.
  1120. coc#util#root_patterns() *coc#util#root_patterns()*
  1121. Get root patterns used for current document.
  1122. Result could be something like: >
  1123. {'global': ['.git', '.hg', '.projections.json'], 'buffer': [], 'server': v:null}
  1124. <
  1125. coc#util#get_config({key}) *coc#util#get_config()*
  1126. Get configuration (mostly defined in coc-settings.json) by {key},
  1127. example: >
  1128. :echo coc#util#get_config('coc.preferences')
  1129. coc#snippet#next() *coc#snippet#next()*
  1130. Jump to next placeholder, does nothing when |coc#jumpable| is 0.
  1131. coc#snippet#prev() *coc#snippet#prev()*
  1132. Jump to previous placeholder, does nothing when |coc#jumpable| is 0.
  1133. *coc#pum*
  1134. coc#pum#visible() *coc#pum#visible()*
  1135. Check if customized popupmenu is visible.
  1136. coc#pum#next({insert}) *coc#pum#next()*
  1137. Select next item of customized popupmenu, insert word when {insert} is
  1138. truth value.
  1139. coc#pum#prev({insert}) *coc#pum#prev()*
  1140. Select previous item of customized popupmenu, insert word when {insert}
  1141. is truth value.
  1142. coc#pum#stop() *coc#pum#stop()*
  1143. Close the customized popupmenu, works like <C-x><C-z> of vim.
  1144. Return <Ignore>
  1145. coc#pum#cancel() *coc#pum#cancel()*
  1146. Cancel the customized popupmenu and revert trigger input, like <C-e>
  1147. of vim. Return empty string.
  1148. coc#pum#confirm() *coc#pum#confirm()*
  1149. Confirm completion and close the customized pum, like <C-y> of vim.
  1150. Return empty string.
  1151. coc#pum#info() *coc#pum#info()*
  1152. Return information of the customized popupmenu, should only be used
  1153. when |coc#pum#visible()| is 1.
  1154. Result contains:
  1155. index Current select item index, 0 based.
  1156. scrollbar Non-zero if a scrollbar is displayed.
  1157. row Screen row count, 0 based.
  1158. col Screen column count, 0 based.
  1159. width Width of pum, including padding and border.
  1160. height Height of pum, including padding and border.
  1161. size Count of displayed complete items.
  1162. inserted Is |v:true| when there is item inserted.
  1163. coc#pum#select({index}, {insert}, {confirm}) *coc#pum#select()*
  1164. Selects an item in the completion popupmenu.
  1165. Return empty string.
  1166. Parameters:~
  1167. {index} Index (zero-based) of the item to select.
  1168. {insert} Whether the selection should be inserted
  1169. in the buffer.
  1170. {confirm} Confirm the completion and dismis the
  1171. popupmenu, implies `insert`.
  1172. coc#pum#insert() *coc#pum#insert()*
  1173. Insert word of current selected item and finish completion.
  1174. Timer is used to make it works as rhs of key-mappings.
  1175. coc#pum#scroll({forward}) *coc#pum#scroll()*
  1176. Scroll the popupmenu forward or backward by page.
  1177. Timer is used to make it works as rhs of key-mappings.
  1178. Return empty string.
  1179. Parameters:~
  1180. {forward} Scroll forward when none zero.
  1181. *coc#notify*
  1182. coc#notify#close_all() *coc#notify#close_all()*
  1183. Close all notification windows.
  1184. coc#notify#do_action([{winid}]) *coc#notify#do_action()*
  1185. Invoke action for all notification windows, or particular window with
  1186. winid.
  1187. coc#notify#copy() *coc#notify#copy()*
  1188. Copy all content from notifications to system clipboard.
  1189. coc#notify#show_sources() *coc#notify#show_sources()*
  1190. Show source name (extension name) in notification windows.
  1191. coc#notify#keep() *coc#notify#keep()*
  1192. Stop auto hide timer of notification windows.
  1193. coc#float#has_float([{all}]) *coc#float#has_float()*
  1194. Check if float window/popup exists, check coc.nvim's float
  1195. window/popup by default.
  1196. coc#float#close_all([{all}]) *coc#float#close_all()*
  1197. Close all float windows/popups created by coc.nvim, set {all} to `1`
  1198. for all float window/popups.
  1199. coc#float#close({winid}) *coc#float#close()*
  1200. Close float window/popup with {winid}.
  1201. coc#float#has_scroll() *coc#float#has_scroll()*
  1202. Return `1` when there is scrollable float window/popup created by
  1203. coc.nvim.
  1204. Example key-mappings:
  1205. >
  1206. if has('nvim-0.4.0') || has('patch-8.2.0750')
  1207. nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  1208. nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  1209. inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  1210. inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  1211. vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  1212. vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  1213. endif
  1214. <
  1215. coc#float#scroll({forward}, [{amount}]) *coc#float#scroll()*
  1216. Scroll all scrollable float windows/popups, scroll backward when
  1217. {forward} is not `1`. {amount} could be number or full page when
  1218. omitted.
  1219. Note: this function requires nvim >= 0.4.0 or vim >= 8.2.750 to work.
  1220. CocRequest({id}, {method}, [{params}]) *CocRequest()*
  1221. Send a request to language client of {id} with {method} and optional
  1222. {params}. Example: >
  1223. call CocRequest('tslint', 'textDocument/tslint/allFixes',
  1224. \ {'textDocument': {'uri': 'file:///tmp'}})
  1225. <
  1226. Vim error will be raised if the response contains an error.
  1227. *CocRequestAsync()*
  1228. CocRequestAsync({id}, {method}, [{params}, [{callback}]])
  1229. Send async request to remote language server.
  1230. {callback} function is called with error and response.
  1231. CocNotify({id}, {method}, [{params}]) *CocNotify()*
  1232. Send notification to remote language server, example:
  1233. >
  1234. call CocNotify('ccls', '$ccls/reload')
  1235. <
  1236. *CocRegistNotification()*
  1237. CocRegistNotification({id}, {method}, {callback})
  1238. Register notification callback for specified client {id} and {method},
  1239. example: >
  1240. autocmd User CocNvimInit call CocRegistNotification('ccls',
  1241. \ '$ccls/publishSemanticHighlight', function('s:Handler'))
  1242. <
  1243. {callback} is called with single param as notification result.
  1244. Note: when register notification with same {id} and {method}, only the
  1245. later registered would work.
  1246. *CocLocations()*
  1247. CocLocations({id}, {method}, [{params}, {openCommand}])
  1248. Send location request to language client of {id} with
  1249. {method} and optional {params}. eg: >
  1250. call CocLocations('ccls', '$ccls/call', {'callee': v:true})
  1251. call CocLocations('ccls', '$ccls/call', {}, 'vsplit')
  1252. <
  1253. {openCommand}: optional command to open buffer, default to
  1254. `coc.preferences.jumpCommand` , |:edit| by default. When it's
  1255. `v:false` locations list would always used.
  1256. *CocLocationsAsync()*
  1257. CocLocationsAsync({id}, {method}, [{params}, {openCommand}])
  1258. Same as |CocLocations()|, but send notification to server instead
  1259. of request.
  1260. CocAction({action}, [...{args}]) *CocAction()*
  1261. Run {action} of coc with optional extra {args}.
  1262. Checkout |coc-actions| for available actions.
  1263. Note: it's recommended to use |CocActionAsync()| unless you have to
  1264. block your vim.
  1265. *CocActionAsync()*
  1266. CocActionAsync({action}, [...{args}, [{callback}]])
  1267. Call CocAction by send notification to server of coc.nvim.
  1268. Optional callback is called with `error` as the first argument and
  1269. `response` as the second argument.
  1270. Checkout |coc-actions| for available actions.
  1271. CocHasProvider({feature}) *CocHasProvider()*
  1272. Check if provider exists for specified feature of current buffer.
  1273. Supported features:
  1274. `rename` `onTypeEdit` `documentLink` `documentColor` `foldingRange`
  1275. `format` `codeAction` `workspaceSymbols` `formatRange` `hover`
  1276. `signature` `documentSymbol` `documentHighlight` `definition`
  1277. `declaration` `typeDefinition` `reference` `implementation` `codeLens`
  1278. `selectionRange`
  1279. CocTagFunc({pattern}, {flags}, {info}) *CocTagFunc()*
  1280. Used for vim's 'tagfunc' option, to make tag search by |CTRL-]| use
  1281. coc.nvim as provider, tag search would be performed when no result
  1282. from coc.nvim.
  1283. Make sure your vim support 'tagfunc' by
  1284. >
  1285. :echo exists('&tagfunc')
  1286. <
  1287. ------------------------------------------------------------------------------
  1288. *coc-actions*
  1289. Available Actions ~
  1290. Acceptable {action} names for |CocAction()| and |CocActionAsync()|.
  1291. "ensureDocument" *CocAction('ensureDocument')*
  1292. Ensure current document is attached to coc.nvim
  1293. |coc-document-attached|, should be used when you need invoke action of
  1294. current document on buffer create.
  1295. Return |v:false| when document can't be attached.
  1296. "diagnosticList" *CocAction('diagnosticList')*
  1297. Get all diagnostic items of the current Neovim session.
  1298. "diagnosticInfo" *CocAction('diagnosticInfo')*
  1299. Show diagnostic message at the current position, do not truncate.
  1300. "diagnosticToggle" [{enable}] *CocAction('diagnosticToggle')*
  1301. Enable/disable diagnostics on the fly, not work when `displayByAle` is
  1302. enabled. You can toggle by specifying {enable}. {enable} can be 0 or 1
  1303. "diagnosticPreview" *CocAction('diagnosticPreview')*
  1304. Show diagnostics under current cursor in preview window.
  1305. "diagnosticRefresh" [{bufnr}] *CocAction('diagnosticRefresh')*
  1306. Force refresh diagnostics for special buffer with {bufnr} or all buffers
  1307. when {bufnr} doesn't exist, returns `v:null` before diagnostics are shown.
  1308. NOTE: Will refresh in any mode.
  1309. Useful when `diagnostic.autoRefresh` is `false`.
  1310. "refreshSource" [{source}] *CocAction('refreshSource')*
  1311. refresh all sources or a source with a name of {source}.
  1312. "sourceStat" *CocAction('sourceStat')*
  1313. get the list of completion source stats for the current buffer.
  1314. "toggleSource" {source} *CocAction('toggleSource')*
  1315. enable/disable {source}.
  1316. "definitions" *CocAction('definitions')*
  1317. Get definition locations of symbol under cursor.
  1318. Return LSP `Location[]`
  1319. "declarations" *CocAction('declarations')*
  1320. Get declaration location(s) of symbol under cursor.
  1321. Return LSP `Location | Location[] | LocationLink[]`
  1322. "implementations" *CocAction('implementations')*
  1323. Get implementation locations of symbol under cursor.
  1324. Return LSP `Location[]`
  1325. "typeDefinitions" *CocAction('typeDefinitions')*
  1326. Get type definition locations of symbol under cursor.
  1327. Return LSP `Location[]`
  1328. "references" [{excludeDeclaration}] *CocAction('references')*
  1329. Get references location list of symbol under cursor.
  1330. {excludeDeclaration}: exclude declaration locations when not zero.
  1331. Return LSP `Location[]`
  1332. "jumpDefinition" [{openCommand}] *CocAction('jumpDefinition')*
  1333. jump to definition locations of the current symbol.
  1334. Return `v:false` when location not found.
  1335. |coc-list-location| is used when more than one position is available,
  1336. for custom location list, use variable: |g:coc_enable_locationlist|.
  1337. To always use |coc-list-location|| for locations, use `v:false` for
  1338. {openCommand}.
  1339. {openCommand}: optional command to open buffer, default to
  1340. `coc.preferences.jumpCommand` in `coc-settings.json`
  1341. "jumpDeclaration" [{openCommand}] *CocAction('jumpDeclaration')*
  1342. jump to declaration locations of the current symbol.
  1343. Return `v:false` when location not found.
  1344. same behavior as "jumpDefinition".
  1345. When {openCommand} is `v:false`, location list would be always used.
  1346. "jumpImplementation" [{openCommand}] *CocAction('jumpImplementation')*
  1347. Jump to implementation locations of the current symbol.
  1348. Return `v:false` when location not found.
  1349. same behavior as "jumpDefinition"
  1350. "jumpTypeDefinition" [{openCommand}] *CocAction('jumpTypeDefinition')*
  1351. Jump to type definition locations of the current symbol.
  1352. Return `v:false` when location not found.
  1353. same behavior as "jumpDefinition"
  1354. "jumpReferences" [{openCommand}] *CocAction('jumpReferences')*
  1355. Jump to references locations of the current symbol, use
  1356. |CocAction('jumpUsed')| to exclude declaration locations.
  1357. Return `v:false` when location not found.
  1358. same behavior as "jumpDefinition"
  1359. "jumpUsed" [{openCommand}] *CocAction('jumpUsed')*
  1360. Jump references locations withtout declarations.
  1361. same behavior as "jumpDefinition"
  1362. "getHover" *CocAction('getHover')*
  1363. Get documentation text array on current position, returns array of
  1364. string.
  1365. "doHover" [{hoverTarget}] *CocAction('doHover')*
  1366. Show documentation of current symbol, return `v:false` when hover not
  1367. found.
  1368. {hoverTarget}: optional specification for where to show hover info,
  1369. defaults to `coc.preferences.hoverTarget` in `coc-settings.json`.
  1370. Valid options: ["preview", "echo", "float"]
  1371. "definitionHover" [{hoverTarget}] *CocAction('definitionHover')*
  1372. Same as |CocAction('doHover')|, but includes definition contents from
  1373. definition provider when possible.
  1374. "showSignatureHelp" *CocAction('showSignatureHelp')*
  1375. Echo signature help of current function, return `v:false` when
  1376. signature not found. You may want to set up an autocmd like this: >
  1377. autocmd User CocJumpPlaceholder call
  1378. \ CocActionAsync('showSignatureHelp')
  1379. <
  1380. "getCurrentFunctionSymbol" *CocAction('getCurrentFunctionSymbol')*
  1381. Return the function string that current cursor in.
  1382. "documentSymbols" [{bufnr}] *CocAction('documentSymbols')*
  1383. Get a list of symbols of current buffer or specific {bufnr}.
  1384. "rename" *CocAction('rename')*
  1385. Rename the symbol under the cursor position, user will be prompted for
  1386. a new name.
  1387. Note: coc.nvim supports rename for disk files, but your language server
  1388. may not.
  1389. "refactor" *CocAction('refactor')*
  1390. Open refactor windows with current symbol as activated cursor ranges.
  1391. Check |coc-config-cursors| and |coc-config-refactor| for related
  1392. configuration.
  1393. Use <CR> to open buffer at current position in split window.
  1394. Use <Tab> to show action menu which have tab open and remove actions.
  1395. "format" *CocAction('format')*
  1396. Format current buffer using the language server.
  1397. Return `v:false` when format failed.
  1398. "formatSelected" [{mode}] *CocAction('formatSelected')*
  1399. Format the selected range, {mode} should be one of visual mode: `v` ,
  1400. `V`, `char`, `line`.
  1401. When {mode} is omitted, it should be called using |formatexpr|.
  1402. "selectionRanges" *CocAction('selectionRanges')*
  1403. Get selection ranges of current position from language server.
  1404. "services" *CocAction('services')*
  1405. Get an information list for all services.
  1406. "toggleService" {serviceId} *CocAction('toggleService')*
  1407. Start or stop a service.
  1408. "codeAction" [{mode}] [{only}] *CocAction('codeAction')*
  1409. Prompt for a code action and do it.
  1410. {mode} could be `line` or `cursor` or result of |visualmode()|,
  1411. current buffer range is used when it's empty string.
  1412. {only} can be title of a codeAction or list of CodeActionKind.
  1413. "codeActionRange" {start} {end} [{kind}] *CocAction('codeActionRange')*
  1414. Run code action for range.
  1415. {start} Start line number of range.
  1416. {end} End line number of range.
  1417. {kind} Code action kind, see |CocAction('codeActions')| for available
  1418. action kind.
  1419. Can be used to create commands like: >
  1420. command! -nargs=* -range CocAction :call CocActionAsync('codeActionRange', <line1>, <line2>, <f-args>)
  1421. command! -nargs=* -range CocFix :call CocActionAsync('codeActionRange', <line1>, <line2>, 'quickfix')
  1422. <
  1423. "codeLensAction" *CocAction('codeLensAction')*
  1424. Invoke the command for codeLens of current line (or the line that
  1425. contains codeLens just above). Prompt would be shown when multiple
  1426. actions are available.
  1427. "commands" *CocAction('commands')*
  1428. Get a list of available service commands for the current buffer.
  1429. "runCommand" [{name}] [...{args}] *CocAction('runCommand')*
  1430. Run a global command provided by the language server. If {name} is not
  1431. provided, a prompt with a list of commands is shown to be selected.
  1432. {args} are passed as arguments of command.
  1433. You can bind your custom command like so: >
  1434. command! -nargs=0 OrganizeImport
  1435. \ :call CocActionAsync('runCommand', 'tsserver.organizeImports')
  1436. "fold" {{kind}} *CocAction('fold')*
  1437. Fold the current buffer, optionally use {kind} for filtering folds,
  1438. {kind} could be either 'comment', 'imports' or 'region'
  1439. Return `v:false` when failed.
  1440. "highlight" *CocAction('highlight')*
  1441. Highlight the symbols under the cursor.
  1442. "openLink" [{command}] *CocAction('openlink')*
  1443. Open a link under the cursor with {command}.
  1444. {command} default to `edit`.
  1445. File and URL links are supported, return `v:false` when failed.
  1446. Uri under cursor is searched when no link returned from documentLink
  1447. provider.
  1448. "extensionStats" *CocAction('extensionStats')*
  1449. Get all extension states as a list. Including `id`, `root` and
  1450. `state`.
  1451. State could be `disabled`, `activated` and `loaded`.
  1452. "toggleExtension" {id} *CocAction('toggleExtension')*
  1453. Enable/disable an extension.
  1454. "uninstallExtension" {id} *CocAction('uninstallExtension')*
  1455. Uninstall an extension.
  1456. "reloadExtension" {id} *CocAction('reloadExtension')*
  1457. Reload an activated extension.
  1458. "activeExtension" {id} *CocAction('activeExtension')*
  1459. Activate extension of {id}.
  1460. "deactivateExtension" {id} *CocAction('deactivateExtension')*
  1461. Deactivate extension of {id}.
  1462. "pickColor" *CocAction('pickColor')*
  1463. Change the color at the current cursor position, requires
  1464. `documentColor` provider |CocHasProvider|.
  1465. Note: only works on mac or when you have python support on Vim and
  1466. have the gtk module installed.
  1467. "colorPresentation" *CocAction('colorPresentation')*
  1468. Change the color presentation at the current color position, requires
  1469. `documentColor` provider |CocHasProvider|.
  1470. "codeActions" [{mode}] [{only}] *CocAction('codeActions')*
  1471. Get codeActions list of current document.
  1472. {mode} can be result of |visualmode()| for visual selected
  1473. range. When it's falsy value, current file is used as range.
  1474. {only} can be array of codeActionKind, possible values including:
  1475. - 'refactor': Base kind for refactoring actions
  1476. - 'quickfix': base kind for quickfix actions
  1477. - 'refactor.extract': Base kind for refactoring extraction actions
  1478. - 'refactor.inline': Base kind for refactoring inline actions
  1479. - 'refactor.rewrite': Base kind for refactoring rewrite actions
  1480. - 'source': Base kind for source actions
  1481. - 'source.organizeImports': Base kind for an organize imports source
  1482. action
  1483. - 'source.fixAll': Base kind for auto-fix source actions
  1484. {only} can also be string, which means filter by tilte of codeAction.
  1485. "organizeImport" *CocAction('organizeImport')*
  1486. Run organize import codeAction for current buffer.
  1487. Show warning when codeAction not found.
  1488. "fixAll" *CocAction('fixAll')*
  1489. Run fixAll codeAction for current buffer.
  1490. Show warning when codeAction not found.
  1491. "quickfixes" [{visualmode}] *CocAction('quickfixes')*
  1492. Get quickfix codeActions of current buffer.
  1493. Add {visualmode} as second argument get quickfix actions with range of
  1494. latest |visualmode()|
  1495. "doCodeAction" {codeAction} *CocAction('doCodeAction')*
  1496. Do a codeAction.
  1497. "doQuickfix" *CocAction('doQuickfix')*
  1498. Do the first preferred quickfix action on current line.
  1499. Throw error when no quickfix action found.
  1500. "addRanges" {ranges} *CocAction('addRanges')*
  1501. Ranges must be provided as array of range type: https://git.io/fjiEG
  1502. "getWordEdit" *CocAction('getWordEdit')*
  1503. Get workspaceEdit of current word, language server used when possible,
  1504. extract word from current buffer as fallback.
  1505. "getWorkspaceSymbols" {input} *CocAction('getWorkspaceSymbols')*
  1506. Get workspace symbols from {input}.
  1507. "resolveWorkspaceSymbol" {symbol} *CocAction('resolveWorkspaceSymbol')*
  1508. Resolve location for workspace {symbol}.
  1509. "diagnosticToggleBuffer" [{bufnr}] [{enable}] *CocAction('diagnosticToggleBuffer')*
  1510. Toggle diagnostics for specific buffer, current buffer is used when
  1511. {bufnr} not provided. 0 for current buffer
  1512. You can toggle by specifying {enable}. {enable} can be 0 or 1
  1513. Note: this will only affect diagnostics shown in the UI, list of all
  1514. diagnostics won't change.
  1515. "showOutline" [{keep}] *CocAction('showOutline')*
  1516. Show |coc-outline| for current buffer. Does nothing when outline
  1517. window already shown for current buffer.
  1518. {keep} override `"outline.keepWindow"` configuration when specified.
  1519. Could be 0 or 1.
  1520. Returns after window is shown (document symbol request is still in
  1521. progress).
  1522. "hideOutline" *CocAction('hideOutline')*
  1523. Close |coc-outline| on current tab. Throws vim error when it can't
  1524. be closed by vim.
  1525. "incomingCalls" [{CallHierarchyItem}] *CocAction('incomingCalls')*
  1526. Retrieve incoming calls from {CallHierarchyItem} or current position
  1527. when not provided.
  1528. "outgoingCalls" [{CallHierarchyItem}] *CocAction('outgoingCalls')*
  1529. Retrieve outgoing calls from {CallHierarchyItem} or current position
  1530. when not provided.
  1531. "showIncomingCalls" *CocAction('showIncomingCalls')*
  1532. Show incoming calls of current function with |coc-tree|, see
  1533. |coc-callHierarchy|
  1534. "showOutgoingCalls" *CocAction('showOutgoingCalls')*
  1535. Show outgoing calls of current function with |coc-tree|.
  1536. "semanticHighlight" *CocAction('semanticHighlight')*
  1537. Request semantic tokens highlight for current buffer.
  1538. "inspectSemanticToken" *CocAction('inspectSemanticToken')*
  1539. Inspect semantic token information at cursor position.
  1540. "rangeSelect" {visualmode} {forward} *CocAction('rangeSelect')*
  1541. Visual select previous or next code range, requires `selectionRange`
  1542. provider.
  1543. {visualmode} should be result of {visualmode} or "" for current cursor
  1544. position.
  1545. {forward} select backward when it's falsy value.
  1546. ------------------------------------------------------------------------------
  1547. COMMANDS *coc-commands*
  1548. :CocStart *:CocStart*
  1549. Start the coc.nvim server, do nothing if it's already started.
  1550. :CocRestart *:CocRestart*
  1551. Restart coc.nvim service.
  1552. Use this command when you want coc to start all over again.
  1553. :CocDisable *:CocDisable*
  1554. Disable handling vim events.
  1555. :CocEnable *:CocEnable*
  1556. Enable handling vim events.
  1557. :CocConfig *:CocConfig*
  1558. Edit the user config file `.vim/coc-settings.json` in
  1559. |coc#util#get_config_home()|
  1560. :CocLocalConfig *:CocLocalConfig*
  1561. Edit or create `.vim/coc-settings.json` in current workspace folder.
  1562. :CocInstall [{option}] {name} ... *:CocInstall*
  1563. Install one or more coc extensions.
  1564. {option}: could be `-sync` for use blocked process to download instead
  1565. of terminal.
  1566. Examples: >
  1567. " Install latest coc-omni
  1568. :CocInstall coc-omni
  1569. " Install coc-omni 1.0.0
  1570. :CocInstall coc-omni@1.0.0
  1571. " Install snippet extension from github
  1572. :CocInstall https://github.com/dsznajder/vscode-es7-javascript-react-snippets
  1573. >
  1574. :CocUninstall {name} *:CocUninstall*
  1575. Uninstall an extension, use <tab> to complete the extension
  1576. name.
  1577. :CocUpdate *:CocUpdate*
  1578. Update all coc extensions to the latest version.
  1579. :CocUpdateSync *:CocUpdateSync*
  1580. Block version of update coc extensions.
  1581. :CocRebuild *:CocRebuild*
  1582. Run `npm rebuild` for coc extensions.
  1583. May be required when environment nodejs get upgraded.
  1584. :CocCommand {name} [{args}] ... *:CocCommand*
  1585. Run a command contributed by extensions, use `<tab>` for name
  1586. completion.
  1587. :CocOpenLog *:CocOpenLog*
  1588. Open log file of coc.nvim.
  1589. Use environmental variable `NVIM_COC_LOG_FILE` for fixed log file.
  1590. Note: the log would be cleared when coc.nvim started.
  1591. Use environment variable `NVIM_COC_LOG_LEVEL` to change log level
  1592. (default 'info', could be 'all', 'trace', 'debug', 'info',
  1593. 'warn', 'error', 'off').
  1594. Use shell command: >
  1595. export NVIM_COC_LOG_LEVEL=debug
  1596. <
  1597. or add: >
  1598. let $NVIM_COC_LOG_LEVEL='debug'
  1599. <
  1600. to the beginning of your `.vimrc`
  1601. :CocInfo *:CocInfo*
  1602. Show version and log information in a split window, useful for
  1603. submitting a bug report.
  1604. :CocDiagnostics [height] *:CocDiagnostics*
  1605. Open vim's |location-list| with diagnostics of current buffer.
  1606. :CocSearch *:CocSearch*
  1607. Perform search by ripgrep https://github.com/BurntSushi/ripgrep,
  1608. refactor window would be opened.
  1609. Note: the search is performed on your files, so normally you should
  1610. save your buffers before invoke this command.
  1611. Common arguments for ripgrep:~
  1612. `-e` `--regexp`: treat search pattern as regexp.
  1613. `-F` `--fixed-strings`: treat search pattern as fixed string.
  1614. `-L` `--follow`: follow symbolic links while traversing directories.
  1615. `-g` `--glob` {GLOB}: Include or exclude files and directories for
  1616. searching that match the given glob.
  1617. `--hidden`: Search hidden files and directories.
  1618. `--no-ignore-vcs`: Don't respect version control ignore files
  1619. (.gitignore, etc.).
  1620. `--no-ignore`: Don't respect ignore files (.gitignore, .ignore, etc.).
  1621. `-w` `--word-regexp`: Only show matches surrounded by word boundaries.
  1622. `-S` `--smart-case`: Searches case insensitively if the pattern is all
  1623. lowercase. Search case sensitively otherwise.
  1624. `--no-config`: Never read configuration files.
  1625. `-x` `--line-regexp`: Only show matches surrounded by line boundaries.
  1626. Use `:man 1 rg` in your terminal for more details.
  1627. Note: By default, hidden files and directories are skipped.
  1628. Note: By default, vcs ignore files including `.gitignore` and
  1629. `.ignore` are respected
  1630. Escape arguments:~
  1631. |<f-args>| is used to convert command line arguments to arguments of
  1632. rg, which means you have to escape space for single argument. For
  1633. example, if you want to search `import { Neovim` , you have to use:
  1634. >
  1635. :CocSearch import\ \{\ Neovim
  1636. <
  1637. The escape for `{` is required because rg use regexp be default, or:
  1638. >
  1639. :CocSearch -F import\ {\ Neovim
  1640. <
  1641. for strict match.
  1642. Change and save:~
  1643. Refactor session is started with searched patterns highlighted, just
  1644. change the text and save refactor buffer to make changes across all
  1645. related files. You can make any kind of changes, including add lines
  1646. and remove lines.
  1647. :CocWatch [extension] *:CocWatch*
  1648. Watch loaded [extension] for reload on file change, use <tab> for
  1649. complete extension id.
  1650. :CocOutline *:CocOutline*
  1651. Invoke |CocAction('showOutline')| by notification.
  1652. ------------------------------------------------------------------------------
  1653. AUTOCMD *coc-autocmds*
  1654. *CocLocationsChange*
  1655. :autocmd User CocLocationsChange {command}
  1656. For building a custom view of locations, set
  1657. |g:coc_enable_locationlist| to 0 and use this autocmd with with
  1658. |g:coc_jump_locations|
  1659. For example, to disable auto preview of location list, use:
  1660. >
  1661. let g:coc_enable_locationlist = 0
  1662. autocmd User CocLocationsChange CocList --normal location
  1663. <
  1664. *CocNvimInit*
  1665. :autocmd User CocNvimInit {command}
  1666. Triggered after the coc services have started.
  1667. If you want to trigger an action of coc after Vim has started, this
  1668. autocmd should be used because coc is always started asynchronously.
  1669. *CocStatusChange*
  1670. :autocmd User CocStatusChange {command}
  1671. Triggered after `g:coc_status` changed, can be used for refresh
  1672. stautsline.
  1673. *CocDiagnosticChange*
  1674. :autocmd User CocDiagnosticChange {command}
  1675. Triggered after the diagnostic status has changed.
  1676. Could be used for updating the statusline.
  1677. *CocJumpPlaceholder*
  1678. :autocmd User CocJumpPlaceholder {command}
  1679. Triggered after a jump to a placeholder. Can be used for
  1680. showing signature help like: >
  1681. autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
  1682. <
  1683. *CocOpenFloat*
  1684. :autocmd User CocOpenFloat {command}
  1685. Triggered when a floating window is opened. The window is not
  1686. focused, use |g:coc_last_float_win| to get window id.
  1687. *CocOpenFloatPrompt*
  1688. :autocmd User CocOpenFloatPrompt {command}
  1689. Triggered when a floating prompt window is opened (triggered after
  1690. CocOpenFloat).
  1691. *CocTerminalOpen*
  1692. :autocmd User CocTerminalOpen {command}
  1693. Triggered when the terminal is shown, can be used for adjusting the
  1694. window height.
  1695. ------------------------------------------------------------------------------
  1696. HIGHLIGHTS *coc-highlights*
  1697. To customize a highlight, simply use |:highlight| command in your vimrc, like:
  1698. >
  1699. " make error texts have a red color
  1700. highlight CocErrorHighlight ctermfg=Red guifg=#ff0000
  1701. <
  1702. Type |:highlight| command with group name to check current highlight.
  1703. Note: don't use `:hi default` for overwriting the highlights.
  1704. Note: user defined highlight commands should appear after the |:colorscheme|
  1705. command and use |ColorScheme| autocmd to make sure customized highlights works
  1706. after color scheme change.
  1707. Markdown related~
  1708. *CocBold* for bold text.
  1709. *CocItalic* for italic text.
  1710. *CocUnderline* for underlined text.
  1711. *CocStrikeThrough* for strikethrough text, like usage of deprecated API.
  1712. *CocMarkdownCode* for inline code in markdown content.
  1713. *CocMarkdownHeader* for markdown header in floating window/popup.
  1714. *CocMarkdownLink* for markdown link text in floating window/popup.
  1715. Diagnostics related~
  1716. *coc-highlights-diagnostics*
  1717. *CocFadeOut* for faded out text, such as for highlighting unnecessary code.
  1718. *CocErrorSign* for error signs.
  1719. *CocWarningSign* for warning signs.
  1720. *CocInfoSign* for information signs.
  1721. *CocHintSign* for hint signs.
  1722. *CocErrorVirtualText* for error virtual text.
  1723. *CocWarningVirtualText* for warning virtual text.
  1724. *CocInfoVirtualText* for information virtual text.
  1725. *CocHintVirtualText* for hint virtual text.
  1726. *CocErrorHighlight* for error code range.
  1727. *CocWarningHighlight* for warning code range.
  1728. *CocInfoHighlight* for information code range.
  1729. *CocHintHighlight* for hint code range.
  1730. *CocDeprecatedHighlight* for deprecated code range, links to
  1731. |CocStrikeThrough| by default.
  1732. *CocUnusedHighlight* for unnecessary code range, links to |CocFadeOut| by
  1733. default.
  1734. *CocErrorLine* line highlight of sign which contains error.
  1735. *CocWarningLine* line highlight of sign which contains warning.
  1736. *CocInfoLine* line highlight of sign which information.
  1737. *CocHintLine* line highlight of sign which contains hint.
  1738. Highlight with higher priority would overwrite highlight with lower priority.
  1739. The priority order:
  1740. |CocUnusedHighlight| > |CocDeprecatedHighlight| > |CocErrorHighlight|
  1741. > |CocWarningHighlight| > |CocInfoHighlight| > |CocHintHighlight|
  1742. Document highlight related~
  1743. *coc-highlights-document*
  1744. Highlights used for highlighting same symbols in the buffer at the current
  1745. cursor position.
  1746. *CocHighlightText* default symbol highlight.
  1747. *CocHighlightRead* for `Read` kind of document symbol.
  1748. *CocHighlightWrite* for `Write` kind of document symbol.
  1749. Float window/popup related~
  1750. *CocFloating* default highlight group of floating windows/popups.
  1751. Default link to |NormalFloat| on neovim and|`Pmenu| on vim.
  1752. *CocErrorFloat* for errors in floating windows/popups.
  1753. *CocWarningFloat* for warnings in floating windows/popups.
  1754. *CocInfoFloat* for infos in floating windows/popups.
  1755. *CocHintFloat* for hints in floating windows/popups.
  1756. Notification window/popup related~
  1757. CocNotification *CocNotification*
  1758. *CocNotificationProgress* for progress line in progress notification.
  1759. *CocNotificationButton* for action buttons in notification window.
  1760. *CocNotificationError* for highlight border of error notification.
  1761. *CocNotificationWarning* for highlight border of warning notification.
  1762. *CocNotificationInfo* for highlight border of info notification.
  1763. List related~
  1764. *coc-highlights-list*
  1765. *CocListLine* for current cursor line.
  1766. *CocListSearch* for matched characters.
  1767. *CocListMode* for mode text in the statusline.
  1768. *CocListPath* for cwd text in the statusline.
  1769. *CocSelectedText* for sign text of selected lines (multiple selection only).
  1770. *CocSelectedLine* for line highlight of selected lines (multiple selection only).
  1771. Tree view related~
  1772. CocTree *CocTree*
  1773. *CocTreeTitle* for title in tree view.
  1774. *CocTreeDescription* for description beside label.
  1775. *CocTreeOpenClose* for open and close icon in tree view.
  1776. *CocTreeSelected* for highlight lines contains selected node.
  1777. Popup menu related~
  1778. *CocPum*
  1779. *CocPumSearch* for matched input characters, linked to |CocSearch| by default.
  1780. *CocPumMenu* for menu of complete item.
  1781. *CocPumShortcut* for shortcut text of source.
  1782. *CocPumDeprecated* for deprecated label.
  1783. *CocPumVirtualText* for virtual text which enabled by
  1784. |coc-config-suggest-virtualText|
  1785. Symbol icons~
  1786. CocSymbol *CocSymbol*
  1787. Highlight groups for symbol icons, including `CompletionItemKind` and
  1788. `SymbolKind` of LSP. The highlight groups link to related |nvim-treesitter|
  1789. highlight groups when possible and fallback to builtin highlight groups.
  1790. *CocSymbolDefault* linked to |hl-MoreMsg| by default.
  1791. *CocSymbolText*
  1792. *CocSymbolUnit*
  1793. *CocSymbolValue*
  1794. *CocSymbolKeyword*
  1795. *CocSymbolSnippet*
  1796. *CocSymbolColor*
  1797. *CocSymbolReference*
  1798. *CocSymbolFolder*
  1799. *CocSymbolFile*
  1800. *CocSymbolModule*
  1801. *CocSymbolNamespace*
  1802. *CocSymbolPackage*
  1803. *CocSymbolClass*
  1804. *CocSymbolMethod*
  1805. *CocSymbolProperty*
  1806. *CocSymbolField*
  1807. *CocSymbolConstructor*
  1808. *CocSymbolEnum*
  1809. *CocSymbolInterface*
  1810. *CocSymbolFunction*
  1811. *CocSymbolVariable*
  1812. *CocSymbolConstant*
  1813. *CocSymbolString*
  1814. *CocSymbolNumber*
  1815. *CocSymbolBoolean*
  1816. *CocSymbolArray*
  1817. *CocSymbolObject*
  1818. *CocSymbolKey*
  1819. *CocSymbolNull*
  1820. *CocSymbolEnumMember*
  1821. *CocSymbolStruct*
  1822. *CocSymbolEvent*
  1823. *CocSymbolOperator*
  1824. *CocSymbolTypeParameter*
  1825. Note: Use configuration |coc-config-suggest-completionItemKindLabels| for customized icon
  1826. characters.
  1827. Semantic token highlight groups~
  1828. *CocSem*
  1829. Semantic highlight groups are starts with `CocSem` which link to related
  1830. |nvim-treesitter| highlight groups when possible and fallback to builtin
  1831. highlight groups, use variable |g:coc_default_semantic_highlight_groups| to
  1832. disable creation of these highlight groups.
  1833. Only semantic tokens types and `deprecated` modifier have default
  1834. highlight groups.
  1835. You need create highlight groups for highlight other modifiers and/or specific
  1836. modifier with type, for example:
  1837. >
  1838. " Add highlights for defaultLibrary modifier
  1839. hi link CocSemDefaultLibrary TSOtherDefaultLibrary
  1840. hi link CocSemDefaultLibraryClass TSTypeDefaultLibrary
  1841. hi link CocSemDefaultLibraryInterface TSTypeDefaultLibrary
  1842. hi link CocSemDefaultLibraryEnum TSTypeDefaultLibrary
  1843. hi link CocSemDefaultLibraryType TSTypeDefaultLibrary
  1844. hi link CocSemDefaultLibraryNamespace TSTypeDefaultLibrary
  1845. " Add highlights for declaration modifier
  1846. hi link CocSemDeclaration TSOtherDeclaration
  1847. hi link CocSemDeclarationClass TSTypeDeclaration
  1848. hi link CocSemDeclarationInterface TSTypeDeclaration
  1849. hi link CocSemDeclarationEnum TSTypeDeclaration
  1850. hi link CocSemDeclarationType TSTypeDeclaration
  1851. hi link CocSemDeclarationNamespace TSTypeDeclaration
  1852. <
  1853. The modifier highlight groups have higher priority.
  1854. Others~
  1855. *CocSearch* highlight group for matched characters in list.
  1856. *CocDisabled* highlight for disabled items, eg: menu item.
  1857. *CocCodeLens* for virtual text of codeLens.
  1858. *CocCursorRange* for highlight of activated cursors ranges.
  1859. *CocLinkedEditing* for highlight of activated linked editing ranges.
  1860. *CocHoverRange* for range of current hovered symbol.
  1861. *CocMenuSel* for current menu item in menu dialog (should only provide
  1862. background color).
  1863. *CocSelectedRange* for highlight ranges of outgoing calls.
  1864. *CocSnippetVisual* for highlight snippet placeholders.
  1865. *CocInlayHint* for highlight inlay hint virtual text block, default linked to
  1866. |CocHintSign|
  1867. ==============================================================================
  1868. TREE SUPPORT *coc-tree*
  1869. Tree view is used for render outline and call hierarchy, following features
  1870. are supported:
  1871. - Data update while keep tree node open/close state.
  1872. - Auto refresh on load error.
  1873. - Click open/close icon to toggle collapse state.
  1874. - Click node to invoke default command.
  1875. - Show tooltip in float window on |CursorHold| when possible.
  1876. - Key-mappings support |coc-tree-mappings|
  1877. - Optional multiple selection.
  1878. - Optional node reveal support.
  1879. - Optional fuzzy filter support.
  1880. - Provide api `window.createTreeView` for extensions.
  1881. Check |coc-config-tree| for related configurations.
  1882. The filetype is `'coctree'`, which can be used to overwrite buffer and window
  1883. options.
  1884. Use variable |w:cocViewId| to detect the kind of tree.
  1885. ------------------------------------------------------------------------------
  1886. TREE KEY MAPPINGS *coc-tree-mappings*
  1887. Default key-mappings are provided for 'coctree' buffer, which can be changed
  1888. by configuration |coc-config-tree|.
  1889. <space> - Select/unselect item, configured by `"tree.key.toggleSelection"`.
  1890. <tab> - Invoke actions of current item, configured by `"tree.key.actions"`.
  1891. <esc> - Close tree window, configured by `"tree.key.close"`.
  1892. <cr> - Invoke command of current item, configured by `"tree.key.invoke"`.
  1893. <C-o> - Move cursor to original window.
  1894. f - Activate filter, configured by `"tree.key.activeFilter"`.
  1895. t - Trigger key to toggle expand state of tree node, configured by
  1896. `tree.key.toggle`.
  1897. M - Collapse all tree node, configured by `"tree.key.collapseAll"`.
  1898. ------------------------------------------------------------------------------
  1899. TREE FILTER *coc-tree-filter*
  1900. Filter mode is used for search for specific node by fuzzy filter, invoke the
  1901. key configured by `"tree.key.activeFilter"` to activate filter mode.
  1902. Note: some tree views not have filter mode supported.
  1903. When filter mode is activated, type normal character to insert filter input
  1904. and following special keys are supported:
  1905. <bs> - Delete last filter character when possible.
  1906. <C-h> - Delete last filter character when possible.
  1907. <C-u> - Clean up filter text.
  1908. <C-p> - Navigate to previous filter text (stored on command invoke).
  1909. <C-n> - Navigate to next filter text (stored on command invoke).
  1910. <esc> - exit filter mode.
  1911. <C-o> - exit filter mode.
  1912. <up> or `"tree.key.selectPrevious"` - Select previous node.
  1913. <down> or `"tree.key.selectNext"` - Select next node.
  1914. <cr> or `"key.key.invoke"` - Invoke command of selected node.
  1915. ==============================================================================
  1916. LIST SUPPORT *coc-list*
  1917. Built-in list support to make working with lists of items easier.
  1918. The following features are supported:
  1919. - Insert & normal mode.
  1920. - Default key-mappings for insert & normal mode.
  1921. - Customize key-mappings for insert & normal mode.
  1922. - Commands for reopening & doing actions with a previous list.
  1923. - Different match modes.
  1924. - Interactive mode.
  1925. - Auto preview on cursor move.
  1926. - Number select support.
  1927. - Built-in actions for locations.
  1928. - Parse ANSI code.
  1929. - Mouse support.
  1930. - Select actions using <tab>.
  1931. - Multiple selections using <space> in normal mode.
  1932. - Select lines by visual selection.
  1933. ------------------------------------------------------------------------------
  1934. LIST COMMAND *coc-list-command*
  1935. :CocList [{...options}] [{source}] [{...args}] *:CocList*
  1936. Open coc list of {source}, example: >
  1937. :CocList --normal location
  1938. <
  1939. For current jump locations.
  1940. See |coc-list-options| for available list options,
  1941. Also check |coc-config-list| for list configuration.
  1942. {args} are sent to source during the fetching of list.
  1943. Press `?` on normal mode to get supported {args} of current
  1944. list.
  1945. When {source} is empty, lists source is used.
  1946. :CocListResume [{name}] *:CocListResume*
  1947. Reopen last opened list, input and cursor position will be preserved.
  1948. :CocListCancel *:CocListCancel*
  1949. Close list, useful when the list is not the current window.
  1950. :CocPrev [{name}] *:CocPrev*
  1951. Invoke default action for the previous item in the last {name} list.
  1952. Doesn't open the list window if it's closed.
  1953. :CocNext [{name}] *:CocNext*
  1954. Invoke the default action for the next item in the last {name} list.
  1955. Doesn't open the list window if it's closed.
  1956. :CocFirst [{name}] *:CocFirst*
  1957. Invoke default action for first item in the last {name} list.
  1958. :CocLast [{name}] *:CocLast*
  1959. Invoke default action for last item in the last {name} list.
  1960. *coc-list-options*
  1961. Options of CocList command~
  1962. --top
  1963. Show list as top window.
  1964. --tab
  1965. Open list in new tabpage.
  1966. --normal
  1967. Start list in normal mode, recommended for short list.
  1968. --no-sort
  1969. Disable sort made by fuzzy score or most recently used, use it when
  1970. it's already sorted.
  1971. --input={input}
  1972. Specify the input on session start.
  1973. --strict
  1974. -S
  1975. Use strict matching instead of fuzzy matching.
  1976. --regex
  1977. -R
  1978. Use regex matching instead of fuzzy matching.
  1979. --ignore-case
  1980. Ignore case when using strict matching or regex matching.
  1981. --number-select
  1982. -N
  1983. Type a line number to select an item and invoke the default action on
  1984. insert mode. Type `0` to select the 10th line.
  1985. --interactive
  1986. -I
  1987. Use interactive mode, list items would be reloaded on input
  1988. change, filter and sort would be done by list implementation.
  1989. Note: only works when the list support interactive mode.
  1990. Note: filtering and sorting would be done by underlying task, which
  1991. means options including `--strict`, `--no-sort`, `--regex`,
  1992. `--ignore-case` would not work at all.
  1993. --auto-preview
  1994. -A
  1995. Start a preview for the current item on the visible list.
  1996. --no-quit
  1997. Not quit list session after do action.
  1998. Note: you may need to refresh the list for current state.
  1999. --first
  2000. Invoke default action for first list item on list open.
  2001. Nothing happens when the list is empty.
  2002. --reverse
  2003. Reverse lines order of list.
  2004. ------------------------------------------------------------------------------
  2005. LIST CONFIGURATION *coc-list-configuration*
  2006. Use `coc-settings.json` for configuration of lists.
  2007. Configuration of list starts with 'list.'.
  2008. See |coc-config-list| or type `list.` in your settings file to get completion
  2009. list (requires coc-json installed).
  2010. For configuration of a specified list, use section that starts with:
  2011. `list.source.{name}`, where `{name}` is the name of list.
  2012. Change default action:~
  2013. If you want to use `tabe` as default action of symbols list, you can use:
  2014. >
  2015. // change default action of symbols
  2016. "list.source.symbols.defaultAction": "tabe"
  2017. <
  2018. in your coc-settings.json
  2019. Change default options:~
  2020. Use `list.source.{name}.defaultOptions` setting like: >
  2021. // make symbols list use normal mode and interactive by default
  2022. "list.source.symbols.defaultOptions": ["--interactive", "--number-select"],
  2023. <
  2024. Note: some list like symbols only work in interactive mode, you must
  2025. include `--interactive` in `defaultOptions`.
  2026. Note: default options will not be used when there're options passed
  2027. with |:CocList| command.
  2028. Change default arguments:~
  2029. Use `list.source.{name}.defaultArgs` setting like: >
  2030. // use regex match for grep source
  2031. "list.source.grep.defaultArgs": ["-regex"],
  2032. Note: default arguments used only when arguments from |:CocList| command is
  2033. empty.
  2034. Note: Type `?` on normal mode to get supported arguments of current list.
  2035. ------------------------------------------------------------------------------
  2036. LIST MAPPINGS *coc-list-mappings*
  2037. Default mappings on insert mode:
  2038. <Esc> - Cancel list session.
  2039. <CR> - Do default action with selected items or current item.
  2040. <C-c> - Stop loading task.
  2041. <C-v> - Paste text from system clipboard.
  2042. <C-l> - Reload list.
  2043. <C-o> - Change to normal mode.
  2044. <Down> - Select next line.
  2045. <Up> - Select previous line.
  2046. <Left> - Move cursor left.
  2047. <Right> - Move cursor right.
  2048. <End> - Move cursor to end of prompt.
  2049. <C-e> - Same as <End>.
  2050. <Home> - Move cursor to start of prompt.
  2051. <C-a> - Same as <Home>.
  2052. <C-f> - Scroll window forward.
  2053. <C-b> - Scroll window backward.
  2054. <Backspace> - Remove previous character of cursor.
  2055. <C-h> - Remove previous character of cursor.
  2056. <C-w> - Remove previous word of cursor.
  2057. <C-u> - Remove characters before cursor.
  2058. <C-n> - Navigate to next input in history.
  2059. <C-p> - Navigate to previous input in history.
  2060. <C-s> - Switch matcher for filter items.
  2061. <C-r> - Insert content from vim's register.
  2062. <Tab> - Select action.
  2063. Default mappings on normal mode:
  2064. <Esc> - Cancel list session.
  2065. <CR> - Do default action with selected items or current item.
  2066. <C-c> - Stop source from fetching more items.
  2067. <C-l> - Reload list.
  2068. <C-a> - Mark all visible items selected.
  2069. <C-o> - Jump to original window on list create.
  2070. <Tab> - Select action.
  2071. <C-e> - Scroll preview window down.
  2072. <C-y> - Scroll preview window up.
  2073. <Space> - Toggle select of current item.
  2074. i,I,o,O,a,A - Change to insert mode.
  2075. p - Preview action.
  2076. : - Cancel list session without closing window.
  2077. ? - Show help of current list.
  2078. t - Do 'tabe' action.
  2079. d - Do 'drop' action.
  2080. s - Do 'split' action.
  2081. Use |coc-list-mappings-custom| to override default mappings.
  2082. *coc-list-mappings-custom*
  2083. Configurations `"list.normalMappings"` and `"list.insertMappings"` are used
  2084. for customizing the list key-mappings, example: >
  2085. "list.insertMappings": {
  2086. "<C-r>": "do:refresh",
  2087. "<C-f>": "feedkeys:\\<C-f>",
  2088. "<C-b>": "feedkeys:\\<C-b>",
  2089. "<C-n>": "normal:j",
  2090. "<C-p>": "normal:k",
  2091. "<C-t>": "action:tabe",
  2092. "<C-x>": "call:MyFunc",
  2093. // paste yanked text to prompt
  2094. "<C-v>": "eval:@@"
  2095. }
  2096. "list.normalMappings": {
  2097. "c": "expr:MyExprFunc"
  2098. "d": "action:delete"
  2099. }
  2100. <
  2101. Note: you should only use mappings that start with `<C-` or `<A-` for insert
  2102. mappings.
  2103. Note: <Esc> can't be remapped for other actions.
  2104. The mapping expression should be `command:arguments`, available commands:
  2105. 'do' - special actions provided by coc list, including:
  2106. 'refresh' - reload list.
  2107. 'selectall' - mark all visible items selected.
  2108. 'switch' - switch matcher used for filter items.
  2109. 'exit' - exit list session.
  2110. 'stop' - stop loading task.
  2111. 'cancel' - cancel list session but leave list window open.
  2112. 'toggle' - toggle selection of current item.
  2113. 'togglemode' - toggle between insert and normal mode.
  2114. 'previous' - move cursor to previous item.
  2115. 'next' - move cursor to next item.
  2116. 'defaultaction' - do default action for selected item(s).
  2117. 'chooseaction' - choose action for selected item(s).
  2118. 'jumpback' - stop prompt and jump back to original window.
  2119. 'previewtoggle' - toggle preview window, requires preview action exists.
  2120. 'previewup' - scroll preview window up.
  2121. 'previewdown' - scroll preview window down.
  2122. 'help' - show help.
  2123. 'prompt' - do prompt action, including:
  2124. 'previous' - change to previous input in history.
  2125. 'next' - change to next input in history.
  2126. 'start' - move cursor to start.
  2127. 'end' - move cursor to end.
  2128. 'left' - move cursor left.
  2129. 'right' - move cursor right.
  2130. 'deleteforward' - remove previous character.
  2131. 'deletebackward' - remove next character.
  2132. 'removetail' - remove characters afterwards.
  2133. 'removeahead' - remove character ahead.
  2134. 'removeword' - remove word before cursor.
  2135. 'insertregister' - insert content from Vim register.
  2136. 'paste' - append text from system clipboard to prompt.
  2137. 'eval' - append text to prompt from result of VimL expression.
  2138. 'action' - execute action of list, use <tab> to find available actions.
  2139. 'feedkeys' - feedkeys to list window, use `\\` in JSON to escape special
  2140. characters.
  2141. 'normal' - execute normal command in list window.
  2142. 'normal!' - execute normal command without remap.
  2143. 'command' - execute command.
  2144. 'call' - call Vim function with |coc-list-context| as only argument.
  2145. 'expr' - same as 'call' but expect the function return action name.
  2146. *coc-list-context*
  2147. Context argument contains the following properties:
  2148. 'name' - name of the list, example: `'location'`.
  2149. 'args' - arguments of the list.
  2150. 'input' - current input of prompt.
  2151. 'winid' - window id on list activated.
  2152. 'bufnr' - buffer number on list activated.
  2153. 'targets' - list of selected targets, checkout |coc-list-target| for properties.
  2154. *coc-list-target*
  2155. Target contains the following properties:
  2156. 'label' - mandatory property that is shown in the buffer.
  2157. 'filtertext' - optional filter text used for filtering items.
  2158. 'location' - optional location of item, check out https://bit.ly/2Rtb6Bo
  2159. 'data' - optional additional properties.
  2160. ------------------------------------------------------------------------------
  2161. LIST SOURCES *coc-list-sources*
  2162. ------------------------------------------------------------------------------
  2163. location *coc-list-location*
  2164. Last jump locations.
  2165. Actions:
  2166. - 'preview' : preview location in preview window.
  2167. - 'open': open location by use
  2168. `"coc.preferences.jumpCommand"`, default action
  2169. - 'tabe': Use |:tabe| to open location.
  2170. - 'drop': Use |:drop| to open location.
  2171. - 'vsplit': Use |:vsplit| to open location.
  2172. - 'split': Use |:split| to open location.
  2173. - 'quickfix': Add selected items to Vim's quickfix.
  2174. extensions *coc-list-extensions*
  2175. Manage coc.nvim extensions.
  2176. Actions:
  2177. - 'toggle' activate/deactivate extension, default action.
  2178. - 'disable' disable extension.
  2179. - 'enable' enable extension.
  2180. - 'lock' lock/unlock extension to current version.
  2181. - 'doc' view extension's README doc.
  2182. - 'fix' fix dependencies in terminal buffer.
  2183. - 'reload' reload extension.
  2184. - 'uninstall' uninstall extension.
  2185. diagnostics *coc-list-diagnostics*
  2186. All diagnostics for the workspace.
  2187. Actions:
  2188. - Same as |coc-list-location|
  2189. folders *coc-list-folders*
  2190. Manage current workspace folders of coc.nvim.
  2191. Actions:
  2192. - 'edit' change the directory of workspace folder.
  2193. - 'delete' remove selected workspace folder.
  2194. outline *coc-list-outline*
  2195. Symbols in the current document.
  2196. Actions:
  2197. - Same as |coc-list-location|
  2198. symbols *coc-list-symbols*
  2199. Search workspace symbols.
  2200. Actions:
  2201. - Same as |coc-list-location|
  2202. services *coc-list-services*
  2203. Manage registered services.
  2204. Actions:
  2205. - 'toggle': toggle service state, default action.
  2206. commands *coc-list-commands*
  2207. Workspace commands.
  2208. Actions:
  2209. - 'run': run selected command, default action.
  2210. links *coc-list-links*
  2211. Links in the current document.
  2212. Actions:
  2213. - 'open': open the link, default action.
  2214. - 'jump': jump to link definition.
  2215. sources *coc-list-completion-sources*
  2216. Available completion sources.
  2217. Actions:
  2218. - 'toggle': activate/deactivate source, default action.
  2219. - 'refresh': refresh source.
  2220. - 'open': open the file where source defined.
  2221. lists *coc-list-lists*
  2222. Get available lists.
  2223. Actions:
  2224. - 'open': open selected list, default action.
  2225. ==============================================================================
  2226. DIALOG SUPPORT *coc-dialog*
  2227. Dialog is special float window/popup that could response to user actions,
  2228. dialog have close button, border, title (optional), bottom buttons(optional).
  2229. Note bottom buttons work different on neovim and vim, on neovim you can
  2230. click the button since neovim allows focus of window, on vim you have to type
  2231. highlighted character to trigger button callback.
  2232. Note dialog feature requires neovim >= 0.4.0 or vim >= 8.2.0750 to work.
  2233. See |coc-config-dialog| for available configurations.
  2234. ------------------------------------------------------------------------------
  2235. *coc-dialog-basic*
  2236. A basic dialog is create by javascript api `window.showDialog` , which is just
  2237. some texts with optional buttons.
  2238. ------------------------------------------------------------------------------
  2239. *coc-dialog-confirm*
  2240. A confirm dialog is used for user to confirm an action, normally created by
  2241. `window.showPrompt()` Confirm dialog uses filter feature on vim8 and
  2242. |getchar()| on neoivm.
  2243. The difference is you can operate vim on vim8, but not on neovim.
  2244. Supported key-mappings:
  2245. <C-c> - force cancel, return -1 for callback.
  2246. <esc>, n, N - reject the action, return 0 for callback.
  2247. y,Y - accept the action, return 1 for callback.
  2248. ------------------------------------------------------------------------------
  2249. *coc-dialog-input*
  2250. An input dialog request user input with optional default value, normally
  2251. created by `window.requestInput`, when `"coc.preferences.promptInput"` is
  2252. false, vim's commandline input prompt is used instead.
  2253. On neovim, it uses float window, on vim8, it opens terminal in popup.
  2254. Supported key-mappings:
  2255. <C-a> - move cursor to first col.
  2256. <C-e> - move cursor to last col.
  2257. <esc> - cancel input, null is received by callback.
  2258. <cr> - accept current input selection of current item.
  2259. QuickPick related (available when created by |coc-dialog-quickpick|).
  2260. <C-f> - scroll forward quickpick list.
  2261. <C-b> - scroll backward quickpick list.
  2262. <C-j> <C-n> <down> - move to next item in quickpick list.
  2263. <C-k> <C-p> <up> - move to previous item in quickpick list.
  2264. <C-space> - toggle selection of current item in quickpick list when
  2265. canSelectMany is supported.
  2266. Note on neovim, other insert mode key-mappings could work.
  2267. Note not possible to configure key-mappings on vim8, to customize key-mappings
  2268. on neovim, use |CocOpenFloatPrompt| with current buffer.
  2269. ------------------------------------------------------------------------------
  2270. *coc-dialog-quickpick*
  2271. A quickpick is a input dialog in the middle with a float window/popup contains
  2272. filtred list items.
  2273. A simple fuzzy filter is used by default.
  2274. See |coc-config-dialog| for available configurations.
  2275. See |coc-dialog-input| for available key-mappings.
  2276. ------------------------------------------------------------------------------
  2277. *coc-dialog-menu*
  2278. A menu dialog is shown aside current cursor position for pick a single item
  2279. from list of items, extensions could use `window.showMenuPicker` to create menu
  2280. dialog.
  2281. Supported key-mappings:
  2282. <Esc> <C-c> - cancel selection.
  2283. <cr> - confirm selection of current item, use
  2284. |dialog.confirmKey| to override.
  2285. 1-9 - select item with 1 based index.
  2286. g - move to first item.
  2287. G - move to last item.
  2288. j <tab> <down> <C-n> - move to next item.
  2289. k <s-tab> <up> <C-p> - move to previous item.
  2290. <C-f> - scroll forward.
  2291. <C-b> - scroll backward.
  2292. ------------------------------------------------------------------------------
  2293. *coc-dialog-picker*
  2294. A picker dialog is used for multiple selection. On neovim, it's possible to
  2295. toggle selection by mouse click inside the bracket. Extensions could use
  2296. `window.showPickerDialog` to create picker dialog.
  2297. Supported key-mappings:
  2298. <Esc> <C-c> - cancel selection.
  2299. <cr> - confirm selection of current item, use
  2300. |dialog.confirmKey| to override.
  2301. <space> - toggle selection of current item.
  2302. g - move to first item.
  2303. G - move to last item.
  2304. j <tab> <down> <C-n> - move to next item.
  2305. k <s-tab> <up> <C-p> - move to previous item.
  2306. <C-f> - scroll forward.
  2307. <C-b> - scroll backward.
  2308. Note when close button is clicked, the selection is canceled with undefined
  2309. result (same as <esc>).
  2310. ==============================================================================
  2311. NOTIFICATION SUPPORT *coc-notification*
  2312. Notification windows are shown from bottom right of the screen. Notifications
  2313. behavior like notifications on VSCode.
  2314. Notifications are created by javascript APIs: `window.showErrorMessage()`,
  2315. `window.showWarningMessage()`, `window.showInformationMessage()`,
  2316. `window.showNotification()` and `window.withProgress()`.
  2317. Possible kind of notifications: 'error', 'warning', 'info' and 'progress'.
  2318. Message notifications (not progress) requires
  2319. |coc-preferences-enableMessageDialog| to be `true`. Message notifications
  2320. without actions would be automatically closed after milliseconds specified by
  2321. |coc-config-notification-timeout|.
  2322. Features:
  2323. - Animated position and 'winblend' on show and hide.
  2324. - Reposition current tab notification windows when notification dismissed.
  2325. - Notification with same options will be replaced to avoid duplicated windows.
  2326. - Percent and message update for progress notification.
  2327. - Click the button (neovim only) or use |coc#notify#do_action()| to invoke
  2328. actions.
  2329. - Click the window would cancel auto close (on neovim and focusable is true).
  2330. - For customize icons, see |g:coc_notify|.
  2331. - For customize highlights, see |CocNotification|.
  2332. - For customize other behaviors, see |coc-config-notification|.
  2333. - For available user actions (ex: "close_all", "do_action" "show_sources"), see
  2334. |coc#notify|.
  2335. Note notification feature requires neovim >= 0.4.0 or vim >= 8.2.0750 to work.
  2336. ==============================================================================
  2337. STATUSLINE SUPPORT *coc-status*
  2338. Diagnostics info and other status info contributed by extensions could be
  2339. shown in statusline.
  2340. The easiest way is add `%{coc#status()}` to your 'statusline' option. Example: >
  2341. set statusline^=%{coc#status()}
  2342. >
  2343. ------------------------------------------------------------------------------
  2344. *coc-status-manual*
  2345. Create function:
  2346. >
  2347. function! StatusDiagnostic() abort
  2348. let info = get(b:, 'coc_diagnostic_info', {})
  2349. if empty(info) | return '' | endif
  2350. let msgs = []
  2351. if get(info, 'error', 0)
  2352. call add(msgs, 'E' . info['error'])
  2353. endif
  2354. if get(info, 'warning', 0)
  2355. call add(msgs, 'W' . info['warning'])
  2356. endif
  2357. return join(msgs, ' ') . ' ' . get(g:, 'coc_status', '')
  2358. endfunction
  2359. <
  2360. Add `%{StatusDiagnostic()}` to your 'statusline' option.
  2361. ------------------------------------------------------------------------------
  2362. *coc-status-airline*
  2363. With vim-airline: https://github.com/vim-airline/vim-airline
  2364. Error and warning display should work in vim-airline out of box.
  2365. Disable vim-airline integration:
  2366. >
  2367. let g:airline#extensions#coc#enabled = 0
  2368. <
  2369. Change error symbol:
  2370. >
  2371. let airline#extensions#coc#error_symbol = 'Error:'
  2372. <
  2373. Change warning symbol:
  2374. >
  2375. let airline#extensions#coc#warning_symbol = 'Warning:'
  2376. <
  2377. Change error format:
  2378. >
  2379. let airline#extensions#coc#stl_format_err = '%E{[%e(#%fe)]}'
  2380. <
  2381. Change warning format:
  2382. >
  2383. let airline#extensions#coc#stl_format_warn = '%W{[%w(#%fw)]}'
  2384. <
  2385. ------------------------------------------------------------------------------
  2386. *coc-status-lightline*
  2387. With lightline.vim: https://github.com/itchyny/lightline.vim
  2388. Use configuration like: >
  2389. let g:lightline = {
  2390. \ 'colorscheme': 'wombat',
  2391. \ 'active': {
  2392. \ 'left': [ [ 'mode', 'paste' ],
  2393. \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ]
  2394. \ },
  2395. \ 'component_function': {
  2396. \ 'cocstatus': 'coc#status'
  2397. \ },
  2398. \ }
  2399. " Use autocmd to force lightline update.
  2400. autocmd User CocStatusChange,CocDiagnosticChange call lightline#update()
  2401. <
  2402. ==============================================================================
  2403. CUSTOM SOURCE *coc-custom-source*
  2404. Creating a custom source in VimL is supported.
  2405. Check out https://github.com/neoclide/coc.nvim/wiki/Create-custom-source
  2406. ==============================================================================
  2407. FAQ *coc-faq*
  2408. ------------------------------------------------------------------------------
  2409. Check out https://github.com/neoclide/coc.nvim/wiki/F.A.Q
  2410. ==============================================================================
  2411. CHANGELOG *coc-changelog*
  2412. See history.md under project root.
  2413. ==============================================================================
  2414. vim:tw=78:nosta:noet:ts=8:sts=0:ft=help:noet:fen: