[FAQ] Document completion issues with plugin managers

Marc Cornellà 2024-07-27 16:25:59 +02:00
parent 0baf11811d
commit cd6fd42b4f
No known key found for this signature in database
GPG Key ID: 0314585E776A9C1B

29
FAQ.md

@ -33,6 +33,7 @@ _If you don't find what you're looking for, and you think it should be covered b
- [Completion issues](#completion-issues)
- [I have enabled a completion plugin but the completion doesn't work](#i-have-enabled-a-completion-plugin-but-the-completion-doesnt-work)
- [I see duplicate typed characters after I complete a command](#i-see-duplicate-typed-characters-after-i-complete-a-command)
- [Completions are not loaded when using a plugin manager](#completions-are-not-loaded-when-using-a-plugin-manager)
- [Zsh errors](#zsh-errors)
- [zsh: no matches found](#zsh-no-matches-found)
- [Some commands no longer work after installing Oh My Zsh](#some-commands-no-longer-work-after-installing-oh-my-zsh)
@ -349,6 +350,34 @@ This usually happens because your theme uses UTF-8 characters but your `locale`
Similar issues: [#6985](https://github.com/ohmyzsh/ohmyzsh/issues/6985#issuecomment-412055789), [#3932](https://github.com/ohmyzsh/ohmyzsh/pull/3932), [#4529](https://github.com/ohmyzsh/ohmyzsh/issues/4529), [#4632](https://github.com/ohmyzsh/ohmyzsh/issues/4632).
#### Completions are not loaded when using a plugin manager
Some of the plugins in Oh My Zsh generate completion files dynamically, and puts them in the cache directory under `$ZSH_CACHE_DIR/completions`.
Oh My Zsh already sets this up for you, as part of the [init script](https://github.com/ohmyzsh/ohmyzsh/blob/master/oh-my-zsh.sh). However, plugin
managers don't run this script automatically as they do some internal optimizations.
To check that you are affected by this, try:
```zsh
echo $ZSH_CACHE_DIR
```
It should return something like `/path/to/oh-my-zsh-folder/cache` or `$HOME/.cache/oh-my-zsh`.
If not, add `ZSH_CACHE_DIR="$HOME/.cache/oh-my-zsh"` in your .zshrc file, before the plugin manager code.
Then, also check that the directories exist:
```zsh
ls -l "$ZSH_CACHE_DIR"
ls -l "$ZSH_CACHE_DIR/completions"
```
If they don't exist, run `mkdir -p $ZSH_CACHE_DIR/completions` once, or add it in the zshrc file after defining `ZSH_CACHE_DIR`.
> [!NOTE]
> This is a workaround when using plugin managers. Ideally we want to make this so that it works out of the box with any plugin manager you use. If you encounter an issue related to this, please +1 Feature Request [#12583](https://github.com/ohmyzsh/ohmyzsh/issues/12583) and add a comment with the plugin manager affected if not already in the list.
### Zsh errors
#### zsh: no matches found