mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
feat(plugins): add fnm plugin (#9864)
Co-authored-by: Ziga Sebenik <ziga.sebenik@oryxgaming.com>
This commit is contained in:
parent
dac3314c76
commit
d9ad99531f
3 changed files with 23 additions and 0 deletions
2
plugins/fnm/.gitignore
vendored
Normal file
2
plugins/fnm/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
_fnm
|
||||
|
9
plugins/fnm/README.md
Normal file
9
plugins/fnm/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# fnm plugin
|
||||
|
||||
This plugin adds autocompletion for [fnm](https://github.com/Schniz/fnm) - a Node.js version manager.
|
||||
|
||||
To use it, add `fnm` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... fnm)
|
||||
```
|
12
plugins/fnm/fnm.plugin.zsh
Normal file
12
plugins/fnm/fnm.plugin.zsh
Normal file
|
@ -0,0 +1,12 @@
|
|||
# COMPLETION FUNCTION
|
||||
if (( $+commands[fnm] )); then
|
||||
if [[ ! -f $ZSH_CACHE_DIR/fnm_version ]] \
|
||||
|| [[ "$(fnm --version)" != "$(< "$ZSH_CACHE_DIR/fnm_version")" ]] \
|
||||
|| [[ ! -f $ZSH/plugins/fnm/_fnm ]]; then
|
||||
fnm completions --shell=zsh > $ZSH/plugins/fnm/_fnm
|
||||
fnm --version > $ZSH_CACHE_DIR/fnm_version
|
||||
fi
|
||||
autoload -Uz _fnm
|
||||
_comps[fnm]=_fnm
|
||||
fi
|
||||
|
Loading…
Reference in a new issue