From 011aa2d57d8b7cf2659ad384b00148e1100d5617 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 9 Dec 2021 21:26:15 +0000 Subject: [PATCH] faster shell startup --- exports | 13 ++++++------- zprofile | 4 ---- zshrc | 16 ++++++++++++++-- 3 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 zprofile diff --git a/exports b/exports index 56ebced..896e59e 100644 --- a/exports +++ b/exports @@ -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 diff --git a/zprofile b/zprofile deleted file mode 100644 index 79e32f1..0000000 --- a/zprofile +++ /dev/null @@ -1,4 +0,0 @@ -# User configuration -source ~/.exports -source ~/.aliases -source ~/.private \ No newline at end of file diff --git a/zshrc b/zshrc index 84491f4..6b51452 100644 --- a/zshrc +++ b/zshrc @@ -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