Create npm completion on first run

This commit is contained in:
Philipp Wahala 2016-02-29 10:16:26 +01:00
commit 69c18453de
2 changed files with 10 additions and 1 deletions

1
plugins/npm/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
npm_completion

View file

@ -1,4 +1,12 @@
eval "$(npm completion 2>/dev/null)"
__NPM_COMPLETION_DIR="${0:A:h}"
__NPM_COMPLETION_FILE="${__NPM_COMPLETION_DIR}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
npm completion > $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
compinit -i -d "${ZSH_COMPDUMP}"
fi
source $__NPM_COMPLETION_FILE
# Install dependencies globally
alias npmg="npm i -g "