7c1ca0e4d85e0de75a3eb8c23b4e799454e0f390
- Author
- Philipp Wahala <philipp.wahala@gmail.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Create and cache npm completion on first run
Signed-off-by: Marc Cornellà <marc.cornella@live.com>
Diff
1diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
2index 422d81ceb89f9b42417b62c0b97830c466833983..ec595e74d9e81f8e65105af6772014a3e9784464 100644
3--- a/plugins/npm/npm.plugin.zsh
4+++ b/plugins/npm/npm.plugin.zsh
5@@ -1,4 +1,10 @@
6-eval "$(npm completion 2>/dev/null)"
7+__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
8+
9+if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
10+ npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
11+fi
12+
13+source $__NPM_COMPLETION_FILE
14
15 # Install dependencies globally
16 alias npmg="npm i -g "