Fuzzy finder and list interface for files, buffers, symbols, and more. Provides unified interface for various data sources with filtering, sorting, preview capabilities, and extensive customization options for efficient navigation and selection.
Core list interface functionality for opening, navigating, and managing lists with various data sources.
:CocList [{options}]
" Open list interface with specified options
" Parameters:
" {options} - string: list name and options
:CocListResume [{name}]
" Resume previously opened list
" Parameters:
" {name} - string: specific list to resume (optional)
:CocListCancel [{name}]
" Cancel active list
" Parameters:
" {name} - string: specific list to cancel (optional)
CocAction('lists')
" Get available list sources
" Returns: array of list source namesUsage Examples:
" Open common lists
:CocList files " File finder
:CocList buffers " Buffer list
:CocList grep " Text search
:CocList symbols " Document symbols
" Resume last list
:CocListResume
" Cancel current list
:CocListCancel
" List navigation mappings
nnoremap <silent> <space>p :CocList files<CR>
nnoremap <silent> <space>b :CocList buffers<CR>
nnoremap <silent> <space>s :CocList symbols<CR>
nnoremap <silent> <space>/ :CocList grep<CR>Navigate between list items and control active lists with dedicated navigation commands.
:CocPrev [{name}]
" Go to previous item in list
" Parameters:
" {name} - string: specific list name (optional)
:CocNext [{name}]
" Go to next item in list
" Parameters:
" {name} - string: specific list name (optional)
:CocFirst [{name}]
" Go to first item in list
" Parameters:
" {name} - string: specific list name (optional)
:CocLast [{name}]
" Go to last item in list
" Parameters:
" {name} - string: specific list name (optional)Usage Examples:
" List navigation mappings
nnoremap <silent> ]l :CocNext<CR>
nnoremap <silent> [l :CocPrev<CR>
nnoremap <silent> ]L :CocLast<CR>
nnoremap <silent> [L :CocFirst<CR>
" Navigate specific lists
:CocNext files " Next file
:CocPrev buffers " Previous buffer
" Navigation in list buffer (when list is active)
" <C-j> / <C-k> " Next/previous item
" <C-f> / <C-b> " Page down/up
" gg / G " First/last itemAvailable list sources for different types of content and navigation scenarios.
" File and Buffer Lists:
:CocList files " File finder with fuzzy search
:CocList buffers " Open buffer list
:CocList mru " Most recently used files
" Search Lists:
:CocList grep [{pattern}] " Text search in workspace
:CocList words " Word completion sources
:CocList searchhistory " Search history
" Symbol Lists:
:CocList symbols " Document symbols
:CocList outline " Document outline
:CocList -I symbols " Interactive workspace symbols
" Diagnostic Lists:
:CocList diagnostics " All diagnostics
:CocList locations " Location list entries
" Extension Lists:
:CocList extensions " Installed extensions
:CocList services " Language services
:CocList commands " Available commands
" Git Lists (with coc-git):
:CocList gfiles " Git files
:CocList gstatus " Git status
:CocList branches " Git branchesUsage Examples:
" File navigation
nnoremap <silent> <C-p> :CocList files<CR>
nnoremap <silent> <space>b :CocList buffers<CR>
nnoremap <silent> <space>m :CocList mru<CR>
" Search functionality
nnoremap <silent> <space>/ :CocList grep<CR>
nnoremap <silent> <space>w :CocList -I symbols<CR>
" Development workflow
nnoremap <silent> <space>d :CocList diagnostics<CR>
nnoremap <silent> <space>o :CocList outline<CR>
nnoremap <silent> <space>c :CocList commands<CR>
" Custom search with pattern
function! SearchPattern()
let pattern = input('Search pattern: ')
if !empty(pattern)
execute 'CocList grep ' . pattern
endif
endfunction
nnoremap <silent> <space>? :call SearchPattern()<CR>Advanced list options for filtering, sorting, and customizing list behavior.
" List options (used with :CocList):
" -I, --interactive " Interactive mode
" -A, --auto-preview " Auto preview
" -N, --normal " Start in normal mode
" --input={text} " Initial input text
" --top " Open at top
" --tab " Open in tab
" --ignore-case " Case insensitive search
" --strict " Strict matching
" --regex " Use regex matching
" --max-height={num} " Maximum window heightUsage Examples:
" Interactive symbol search
:CocList -I symbols
" Auto-preview files
:CocList -A files
" Case-insensitive file search
:CocList --ignore-case files
" Search with initial input
:CocList --input=component files
" Large list with height limit
:CocList --max-height=15 files
" Regex search in grep
:CocList --regex grep
" Open list in tab
:CocList --tab files
" Combined options
:CocList -I -A --ignore-case --max-height=20 filesCustomize list appearance, behavior, and key mappings through configuration options.
" List configuration options:
"list.indicator": string // List indicator symbol
"list.selectedSignText": string // Selection indicator
"list.interactiveDebounceTime": number // Input debounce time
"list.autoResize": boolean // Auto-resize list window
"list.maxHeight": number // Maximum list height
"list.maxPreviewHeight": number // Maximum preview height
"list.previewSplitRight": boolean // Preview position
"list.previewHighlightGroup": string // Preview highlight
" Key mapping configuration:
"list.normalMappings": object // Normal mode mappings
"list.insertMappings": object // Insert mode mappingsUsage Examples:
" List customization
{
"list.indicator": "❯",
"list.selectedSignText": "▶",
"list.interactiveDebounceTime": 100,
"list.autoResize": true,
"list.maxHeight": 25,
"list.maxPreviewHeight": 15,
"list.previewSplitRight": true,
"list.previewHighlightGroup": "CocListPreview",
"list.normalMappings": {
"<C-c>": "do:exit",
"<C-j>": "do:next",
"<C-k>": "do:previous",
"<C-v>": "action:vsplit",
"<C-s>": "action:split",
"<C-t>": "action:tabe",
"dd": "action:delete"
},
"list.insertMappings": {
"<C-j>": "do:next",
"<C-k>": "do:previous",
"<C-v>": "action:vsplit",
"<C-s>": "action:split",
"<C-t>": "action:tabe"
}
}Create and manage custom list sources for specialized workflows and data sources.
" Custom list source registration (via extensions):
CocAction('listLoadItems', {name}, {items})
" Load items into custom list
" Parameters:
" {name} - string: list source name
" {items} - array: list items
CocAction('listNames')
" Get all available list names
" Returns: array of list source namesUsage Examples:
" Custom todo list
function! TodoList()
let todos = []
let files = split(glob('**/*.js'), '\n')
for file in files
let lines = readfile(file)
let lnum = 0
for line in lines
let lnum += 1
if line =~# 'TODO\|FIXME\|XXX'
call add(todos, {
\ 'text': file . ':' . lnum . ': ' . trim(line),
\ 'filename': file,
\ 'lnum': lnum,
\ 'col': 1
\ })
endif
endfor
endfor
call setloclist(0, todos, 'r')
lopen
endfunction
command! TodoList call TodoList()
nnoremap <silent> <space>t :TodoList<CR>
" Recent git commits list
function! GitCommitList()
let commits = systemlist('git log --oneline -20')
let items = []
for commit in commits
let hash = matchstr(commit, '^\w\+')
call add(items, {
\ 'text': commit,
\ 'user_data': hash
\ })
endfor
call CocAction('listLoadItems', 'commits', items)
CocList commits
endfunction
command! Commits call GitCommitList()Perform actions on list items and integrate lists with other coc.nvim features.
" List actions (available in list buffer):
" <CR>, o " Open item (default action)
" <C-v> " Open in vertical split
" <C-s>, <C-x> " Open in horizontal split
" <C-t> " Open in new tab
" p " Preview item
" q, <Esc> " Quit list
" <C-c> " Cancel list
" i, I, a, A " Insert mode (interactive lists)
" <Space> " Toggle selection
" <Tab> " Select action
" Action configuration:
"list.defaultAction": string // Default open action
"list.actionKeymap": object // Custom action mappingsUsage Examples:
" Custom action handling
{
"list.defaultAction": "edit",
"list.actionKeymap": {
"ctrl-v": "vsplit",
"ctrl-s": "split",
"ctrl-t": "tabe",
"ctrl-d": "delete",
"ctrl-r": "reload"
}
}
" Custom list with actions
function! ProjectFileList()
CocList --normal --auto-preview files
" Setup custom actions for this context
augroup project_list
autocmd!
autocmd FileType list nnoremap <buffer> <silent> e :action edit<CR>
autocmd FileType list nnoremap <buffer> <silent> d :action delete<CR>
augroup end
endfunction
nnoremap <silent> <space>P :call ProjectFileList()<CR>