Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrsh7th/cmp-cmdline
nvim-cmp source for vim's cmdline
https://github.com/hrsh7th/cmp-cmdline
nvim-cmp
Last synced: 5 days ago
JSON representation
nvim-cmp source for vim's cmdline
- Host: GitHub
- URL: https://github.com/hrsh7th/cmp-cmdline
- Owner: hrsh7th
- License: mit
- Created: 2021-10-21T16:43:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-27T09:13:44.000Z (7 months ago)
- Last Synced: 2024-11-06T16:41:15.921Z (7 days ago)
- Topics: nvim-cmp
- Language: Lua
- Homepage:
- Size: 26.4 KB
- Stars: 559
- Watchers: 8
- Forks: 44
- Open Issues: 57
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmp-cmdline
nvim-cmp source for vim's cmdline.
# Setup
Completions for `/` search based on current buffer:
```lua
-- `/` cmdline setup.
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
```Completions for command mode:
```lua
-- `:` cmdline setup.
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{
name = 'cmdline',
option = {
ignore_cmds = { 'Man', '!' }
}
}
})
})
```For the buffer source to work, [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) is needed.
# Option
### ignore_cmds: string[]
Default: `{ "Man", "!" }`You can specify ignore command name.
### treat_trailing_slash: boolean
Default: `true``vim.fn.getcompletion` can return path items.
unfortunately, that items has trailing slash so we don't narrowing with next directory with pressing `/`.if you turnd on this option, `cmp-cmdline` removes trailing slash automatically.