fnm.plugin.zsh
582 bytes
1if (( ! $+commands[fnm] )); then
2 return
3fi
4
5# If the completion file doesn't exist yet, we need to autoload it and
6# bind it to `fnm`. Otherwise, compinit will have already done that.
7if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnm" ]]; then
8 typeset -g -A _comps
9 autoload -Uz _fnm
10 _comps[fnm]=_fnm
11fi
12
13fnm completions --shell=zsh >| "$ZSH_CACHE_DIR/completions/_fnm" &|
14
15if zstyle -t ':omz:plugins:fnm' autostart; then
16 local -a fnm_env_cmd
17 if zstyle -T ':omz:plugins:fnm' use-on-cd; then
18 fnm_env_cmd+=("--use-on-cd")
19 fi
20 eval "$(fnm env --shell=zsh $fnm_env_cmd)"
21fi