Skip to main content
Docs / CORE FEATURES

Lists

Use CocList commands, options, mappings, built-in sources, and the custom List API.

Lists

CocList provides interactive lists for locations, diagnostics, symbols, extensions, commands, services, notifications, and extension-provided sources.

Open and resume lists

CommandPurpose
:CocList [options] [source] [args]Open a list. With no source, opens the lists source.
:CocListResume [name]Restore the previous list, including input and cursor position.
:CocListCancelClose the active list even when it is not the current window.
:CocPrev [name] / :CocNext [name]Run the default action for the previous or next item.
:CocFirst [name] / :CocLast [name]Run the default action for the first or last item.

Arguments after the source are passed to that source. Press ? in normal mode to see its supported arguments.

Command options

OptionEffect
--top / --tabOpen at the top or in a new tab page.
--normalStart in normal mode.
--no-sortKeep source order instead of fuzzy/MRU sorting.
--input=TEXTSet the initial input.
--height=NUMBEROverride list height.
--strict, -SUse strict matching.
--regex, -RUse regular-expression matching.
--ignore-caseIgnore case for strict or regex matching.
--number-select, -NType a number to invoke the corresponding item.
--interactive, -IReload items on input changes when the source supports it.
--auto-preview, -APreview the current item immediately.
--no-quitKeep the list open after an action.
--firstInvoke the first item after loading.
--reverseRender the first item at the bottom.

Interactive sources perform their own filtering and sorting, so --strict, --regex, --ignore-case, and --no-sort have no effect. The built-in symbols source is interactive-only.

Configure a source

Use list.source.<name> settings to define a source’s default action, options, and arguments:

jsonc snippet
1{
2 "list.source.symbols.defaultAction": "tabe",
3 "list.source.symbols.defaultOptions": ["--interactive", "--number-select"],
4 "list.source.grep.defaultArgs": ["-regex"]
5}

Default options are used only when the command supplies no options; default arguments are used only when it supplies no arguments. Search list. in the Settings Generator for layout, preview, mappings, signs, matching, and status-line settings.

Default mappings

ModeCommon mappings
Insert<CR> default action, <C-c> stop, <C-l> reload, <C-o> normal mode, <C-n>/<C-p> input history, <C-s> matcher, <Tab> actions.
Normal<CR> default action, <C-a> select all, <C-o> original window, <Space> selection, p preview, ? help, t/d/s/r tabe/drop/split/refactor.

Customize list.insertMappings and list.normalMappings with expressions such as do:previewtoggle, action:vsplit, prompt:next, feedkeys:..., normal:..., command:..., call:..., and expr:.... Prefer <C-...> or <A-...> keys in insert mode; <Esc> cannot be reassigned.

Built-in list sources

SourceDefault action and notable actions
locationopen; preview, tabe, drop, vsplit, split, quickfix, refactor.
diagnosticsLocation actions; supports buffer, workspace-folder, and severity filters.
outlineLocation actions; document symbols from LSP or ctags.
symbolsLocation actions; interactive workspace-symbol search.
linksOpen or jump to a document link.
extensionsToggle, configure, open, disable, enable, lock, help, reload, or uninstall.
foldersEdit, delete, or create a file in a workspace folder.
notificationsClear notification history.
servicesToggle a registered language-client service.
commandsRun or append a registered command.
sourcesToggle, refresh, or open a completion source.
listsOpen another registered List.

Extensions can register more sources dynamically. For example, coc-lists adds files, grep, MRU, buffers, quickfix, location list, tags, history, and other Vim-oriented sources.

Custom List sources

Extension authors register an IList with listManager.registerList(). A list supplies name, defaultAction, actions, and loadItems(context, token). It can optionally support interactive loading, custom options, item resolution, highlights, and disposal.

A ListItem can provide a label, filter/sort text, location, data, ANSI highlights, and preselection. For large or streaming results, return a ListTask that emits data, end, and error events and implements dispose().

See the TypeScript API for IList, ListItem, ListTask, ListContext, and listManager.registerList().

Source of truth: :h coc-list.