Skip to content

Commit

Permalink
[FAQ] Add cache completions to $fpath when using plugin managers
Browse files Browse the repository at this point in the history
  • Loading branch information
mcornella committed Jul 27, 2024
1 parent cd6fd42 commit f49b34f
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,25 @@ 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`.
If they don't exist, run `mkdir -p $ZSH_CACHE_DIR/completions` once, or add this command in the .zshrc file after defining `ZSH_CACHE_DIR`.
Finally, you should check whether this directory is also added to `$fpath`:
```zsh
print -l $fpath | grep "$ZSH_CACHE_DIR/completions"
```
A line should appear with the path to the `$ZSH_CACHE_DIR/completions` folder. If not, you should also add this directory to `$fpath` in your .zshrc file.
Here's what you should add to your .zshrc file to fix this, before any lines loading Oh My Zsh or its plugins:

```zsh
ZSH_CACHE_DIR="$HOME/.cache/oh-my-zsh" # or any other directory you want
mkdir -p "$ZSH_CACHE_DIR/completions"
fpath=("$ZSH_CACHE_DIR/completions" $fpath)
```

After that everything should work again.

> [!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.
Expand Down

0 comments on commit f49b34f

Please sign in to comment.