
Basic list sources for coc.nvim
Published Package Summary
coc-lists
Some basic list sources for coc.nvim
Including:
-
bufferscurrent buffer list. -
changeschanges list. -
cmdhistoryhistory of commands. -
colorscolors schemes. -
filessearch files from current cwd. -
filetypesfile types. -
grepgrep text from current cwd. -
helptagshelptags of vim. -
linessearch lines by regex patterns. -
locationlistitems from vim's location list. -
mapskey mappings. -
marksmarks of vim. -
mrumost recent used files. -
quickfixitems from vim's quickfix list. -
registersregisters of vim. -
searchhistoryhistory of search. -
sessionssession list. -
tagssearch tag files. -
vimcommandsavailable vim commands. -
windowswindows of vim. -
wordssearch word in current buffer. -
functionsavailable vim functions.
For snippets list, use coc-snippets.
For git related list, use coc-git.
For yank history, use coc-yank.
Install
In your vim/neovim, run command:
:CocInstall coc-lists
Checkout :h coc-list for usage.
Options
Tip: type ? on normal mode to get detail help of current list.
Available options for coc-lists:
session.saveOnVimLeaveSave session on VimLeavePre., default totruesession.directorydirectory for session files, default to~/.vim/sessionssession.restartOnSessionLoadRestart vim with cwd changed on session load, support neovim on iTerm2 only.lists.disabledLists: List names to disable form load., default:[]list.source.files.command: Command used for search for files, default:""list.source.files.args: Arguments for search command, default:[]list.source.files.excludePatterns: Minimatch patterns that should be excluded., default:[]list.source.mru.maxLength: Max length of mru list., default:1000list.source.mru.ignoreGitIgnore: Ignore git ignored files., default:falselist.source.mru.excludePatterns: Minimatch patterns that should be excluded., default:["**/.git/*","/tmp/*"]list.source.grep.useLiteral: Use literal match unless specified regex options, default: true., default:truelist.source.grep.command: Command used for grep, default to 'rg'., default:"rg"could bergorag.list.source.grep.maxColumns: Don't print lines longer than this limit in bytes, ripgrep only..list.source.tags.command: Command used for generate tags., default:"ctags -R ."list.source.grep.args: Arguments for grep command, always used for grep, default:[]list.source.grep.excludePatterns: Minimatch patterns of files that should be excluded, use .ignore file is recommended., default:[]
F.A.Q
Q: Hidden files not exists using files source.
A: You have to pass --hidden to ripgrep by using configuration:
`list.source.files.args`: ['--hidden', '--files']
Q: How to ignore files using files/grep source.
A: You can add .ignore file in your project root, which would be respected by
ripgrep or use list.sourcefiles.excludePatterns configuration.
Q: How to make grep easier?
A: Create custom command like:
" grep word under cursor
command! -nargs=+ -complete=custom,s:GrepArgs Rg exe 'CocList grep '.<q-args>
function! s:GrepArgs(...)
let list = ['-S', '-smartcase', '-i', '-ignorecase', '-w', '-word',
\ '-e', '-regex', '-u', '-skip-vcs-ignores', '-t', '-extension']
return join(list, "\n")
endfunction
" Keymapping for grep word under cursor with interactive mode
nnoremap <silent> <Leader>cf :exe 'CocList -I --input='.expand('<cword>').' grep'<CR>
Q: How to grep by motion?
A: Create custom keymappings like:
vnoremap <leader>g :<C-u>call <SID>GrepFromSelected(visualmode())<CR>
nnoremap <leader>g :<C-u>set operatorfunc=<SID>GrepFromSelected<CR>g@
function! s:GrepFromSelected(type)
let saved_unnamed_register = @@
if a:type ==# 'v'
normal! `<v`>y
elseif a:type ==# 'char'
normal! `[v`]y
else
return
endif
let word = substitute(@@, '\n$', '', 'g')
let word = escape(word, '| ')
let @@ = saved_unnamed_register
execute 'CocList grep '.word
endfunction
Q: How to grep current word in current buffer?
A: Create kep-mapping like:
nnoremap <silent> <space>w :exe 'CocList -I --normal --input='.expand('<cword>').' words'<CR>
Q: How to grep word in a specific folder?
A: Pass -- /folder/to/search/from to CocList grep
:CocList grep word -- /folder/to/search/from
License
MIT
- Basic list sources for coc.nvim
- *
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
Published with coc-lists@1.5.8 as history.md.
1.5.8
- rename logo file (15dc794)
- add logo.png (f4c528b)
1.5.7
- fix release.yml (f9feb00)
1.5.6
- fix: use current runtimepath for helptags (#156) (4b73ada)
1.5.5
- test: split tests by source and fix verbose source lookup (74ea0c3)
- fix: paths, session restart, MRU and task completion issues (9a81d09)
- Improve tests and automate releases (d121dfa)
1.5.4
Contributed Commands
All contributes.commands entries from the published package manifest for coc-lists@1.5.8.
| Command (:CocCommand) | Description |
|---|---|
| session.save | Save current vim state to session file. |
| session.load | Load session by name. |
| session.restart | Restart vim with current session. |
| mru.validate | Validate mru files list, which remove files that doesn't exist. |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Directory for store session files, default to ~/.vim/sessions when empty."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "List names to disable form load."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Arguments for grep command, always used for grep"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Arguments for search command"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Save session on VimLeavePre."
}Raw JSON Schema
{
"enum": [
"rg",
"ag"
],
"type": "string",
"default": "rg",
"description": "Command used for grep, default to 'rg'."
}Raw JSON Schema
{
"type": "string",
"default": "ctags -R .",
"description": "Command used for generate tags."
}Raw JSON Schema
{
"type": "string",
"default": "",
"description": "Command used for search for files"
}Raw JSON Schema
{
"type": "number",
"default": 0,
"description": "Limit the number of matching lines in interactive mode, 0 is not limited."
}Raw JSON Schema
{
"type": "number",
"default": 1000,
"description": "Max length of mru list."
}Raw JSON Schema
{
"type": "number",
"default": 300,
"description": "Don't print lines longer than this limit in bytes, ripgrep only."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Use literal match unless specified regex options, default: true."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Filter files by name only"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Restart vim with cwd changed on session load, support neovim on iTerm2 only."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Filter files by name only"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [
"**/.git/*",
"/tmp/*"
],
"description": "Minimatch patterns that should be excluded."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Ignore git ignored files."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Minimatch patterns of files that should be excluded, use .ignore file is recommended."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "Minimatch patterns that should be excluded."
}