https://github.com/tamago324/cmp-zsh
nvim-cmp source for zsh
https://github.com/tamago324/cmp-zsh
nvim-cmp
Last synced: 11 months ago
JSON representation
nvim-cmp source for zsh
- Host: GitHub
- URL: https://github.com/tamago324/cmp-zsh
- Owner: tamago324
- License: mit
- Created: 2021-10-03T08:08:37.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-01T16:42:35.000Z (over 2 years ago)
- Last Synced: 2025-07-14T20:18:45.917Z (11 months ago)
- Topics: nvim-cmp
- Language: Shell
- Homepage:
- Size: 15.6 KB
- Stars: 71
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cmp-zsh
Zsh completion source for [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
## Requirements
* [Neovim](https://github.com/neovim/neovim/)
* [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
* zsh/zpty module
```zsh
zmodload zsh/zpty
```
## Installation
```vim
Plug 'hrsh7th/nvim-cmp'
Plug 'tamago324/cmp-zsh'
Plug 'Shougo/deol.nvim' " recommended to use together.
lua << EOF
require'cmp'.setup {
-- ...
sources = {
{ name = 'zsh' }
}
}
EOF
```
## Configuration
It saves compdump file in `$CMP_ZSH_CACHE_DIR` or `$XDG_CACHE_HOME` or
`$HOME/.cache` directory.
In order to show completions defined in your zshrc you can setup cmp zsh like this.
*Note*: This feature is experimental. If you enable it and don't get any
results try disabling it.
```lua
require'cmp_zsh'.setup {
zshrc = true, -- Source the zshrc (adding all custom completions). default: false
filetypes = { "deoledit", "zsh" } -- Filetypes to enable cmp_zsh source. default: {"*"}
}
```
Alternatively you can use this trick (if sourcing your zshrc is very slow):
Add the directory of the complete function to `$FPATH` in `~/.zshenv`.
```zsh
# completions
if [ -d $HOME/.zsh/comp ]; then
export FPATH="$HOME/.zsh/comp:$FPATH"
fi
```
## Credit
* [deoplete-zsh](https://github.com/deoplete-plugins/deoplete-zsh)
* [zsh-capture-completion](https://github.com/Valodim/zsh-capture-completion)
## License
MIT