diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh index 422d81ceb..ec595e74d 100644 --- a/plugins/npm/npm.plugin.zsh +++ b/plugins/npm/npm.plugin.zsh @@ -1,4 +1,10 @@ -eval "$(npm completion 2>/dev/null)" +__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion" + +if [[ ! -f $__NPM_COMPLETION_FILE ]]; then + npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE +fi + +source $__NPM_COMPLETION_FILE # Install dependencies globally alias npmg="npm i -g "