faster shell startup

This commit is contained in:
Matthias Kretschmann 2021-12-09 21:26:15 +00:00
parent b08371bc53
commit 011aa2d57d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 20 additions and 13 deletions

13
exports
View File

@ -25,20 +25,19 @@ export CDPATH=$CDPATH:~/Code
# nvm
# defer loading until needed for faster shell startup
# declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
declare -a NODE_GLOBALS=(`find ~/.nvm/versions/node -maxdepth 3 -type l -wholename '*/bin/*' | xargs -n1 basename | sort | uniq`)
# NODE_GLOBALS+=("node")
# NODE_GLOBALS+=("nvm")
NODE_GLOBALS+=("node")
NODE_GLOBALS+=("nvm")
load_nvm () {
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
}
load_nvm
# for cmd in "${NODE_GLOBALS[@]}"; do
# eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
# done
for cmd in "${NODE_GLOBALS[@]}"; do
eval "${cmd}(){ unset -f ${NODE_GLOBALS}; load_nvm; ${cmd} \$@ }"
done
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true

View File

@ -1,4 +0,0 @@
# User configuration
source ~/.exports
source ~/.aliases
source ~/.private

16
zshrc
View File

@ -46,7 +46,13 @@ setopt pushdminus
#
# Completion
#
autoload -Uz compinit; compinit
autoload -Uz compinit
for dump in ~/.zcompdump(N.mh+24); do
compinit
done
compinit -C
setopt auto_menu
setopt always_to_end
@ -74,7 +80,7 @@ if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:(ssh|scp|rsync|slogin):*' hosts $h
fi
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# source <(kubectl completion zsh)
@ -82,3 +88,9 @@ source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# Other
#
setopt prompt_subst
source ~/.exports
source ~/.aliases
source ~/.private
# zprof