-
-
Notifications
You must be signed in to change notification settings - Fork 958
Using coc list
Coc list was created to make working with lists of things easier and more convenient, ex: locations and extensions.
Coc list is inspired by denite.nvim and it's faster.
-
Insert mode and normal mode, use insert mode for filtering and normal mode to do everything else.
-
Actions for items, each list provides different actions. You can create keymaps for them and press
<tab>
to run one of them. -
Multiple selection, you can do multiple selections in different ways:
- Press
<space>
to toggle the selection of an item. - Drag your mouse to select items.
- On normal mode, select lines in visual select mode and then press
<space>
to toggle selection of lines.
- Press
-
Commands for previous list:
-
:CocListResume
reopen last list, restore window and cursor position. -
:CocNext
do default action with next item. -
:CocPrev
do default action with previous item.
-
-
Different match modes, coc use fuzzy match by default, but you can change to use strict match or regex match by
<c-s>
. -
Interactive mode, use
--interactive
in:CocList
command to start list in interactive mode, when activated, all items would be fetched on input change, and the list was sorted and filtered by list implementation.- Some source like
symbols
(use workspace symbols feature of language server) only works on interactive mode. - Interactive is only available when the list supports it.
- Some source like
-
Default key-mappings, check out
:h coc-list-mappings
for default mappings, you can override them by use"list.normalMappings"
and"list.insertMappings"
in configuration file. -
Auto preview feature: the preview window would be adjusted when cursor moved in list window.
-
Number select feature, add
--number-select
to:CocList
command, then your can type 1-9 to do default action for that line of item. -
Parse ansi from item label, list can pass labels with ansi code, and the colors would be parsed and highlighted as expected
Using highlight form output of ripgrep
-
Mouse support, you can click to change cursor position, double click to select item and do the default action, or drag to select multiple items.
-
Advanced fuzzy score, for items with location, the match of a filename will have a higher score, the beginning of path segments have higher scores
Only characters that have the best match get highlighted
-
Input history, you can use
<C-n>
and<C-p>
on insert mode to navigate command history list, the list is filtered with CWD and fuzzy match of current input (when not empty).
Checkout :h coc-list
for detailed documentation.
-
When the list is open, you can still use your mouse to scroll other windows.
-
Create custom keymaps to make doing actions easier:
"list.normalMappings": { "t": "action:tabe", "v": "action:vsplit", "s": "action:split", "d": "expr:GetDeleteAction" }, "list.insertMappings": { "<C-t>": "action:tabe", "<C-w>": "command:wincmd k" },
-
You can move to another window when the list is opened, the prompt will be deactivated.
-
Use variables
g:terminal_color_{0-7}
to customize ansi highlight colors, same as terminal colors of neovim:h terminal-configuration
. -
Press
?
on normal mode to get help.
-
outline
outline of current document, provided by language server orctags
. -
sources
loaded completion sources. -
symbols
search workspace symbol. -
commands
registered coc commands. -
location
latest jump locations. -
services
registered language client services. -
extensions
installed extensions. -
diagnostics
diagnostics of current workspace -
links
links of current document, provided by language server. -
lists
available list sources. -
output
current output channels.
Some coc extensions make use of coc list:
-
coc-lists provide some basic lists, including
files
,mru
,grep
etc. - coc-snippets provide snippets list.