From 818089e853f55ea43851d572dcd813199f85bf05 Mon Sep 17 00:00:00 2001 From: pfych Date: Mon, 21 Jul 2025 08:45:38 +1000 Subject: [PATCH] Use zsh-nvm to reduce shell startup time by 2x (0.2s > 0.09s) --- .config/zsh/plugins.sh | 5 +++++ .config/zsh/plugins/zsh-nvm | 1 + .config/zsh/shared.sh | 5 ----- .gitmodules | 3 +++ .zshrc | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) create mode 160000 .config/zsh/plugins/zsh-nvm diff --git a/.config/zsh/plugins.sh b/.config/zsh/plugins.sh index 9d78774..f6507a8 100644 --- a/.config/zsh/plugins.sh +++ b/.config/zsh/plugins.sh @@ -4,12 +4,17 @@ source "$CONFIGDIR/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.z source "$CONFIGDIR/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" # Autocomplete +ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="20" ZSH_AUTOSUGGEST_USE_ASYNC=true ZSH_AUTOSUGGEST_STRATEGY=(history completion) # FZF source <(fzf --zsh) +# NVM +export NVM_LAZY_LOAD=true +source "$CONFIGDIR/zsh/plugins/zsh-nvm/zsh-nvm.plugin.zsh" + # Prompt configPrompt() { case $(uname -n) in diff --git a/.config/zsh/plugins/zsh-nvm b/.config/zsh/plugins/zsh-nvm new file mode 160000 index 0000000..745291d --- /dev/null +++ b/.config/zsh/plugins/zsh-nvm @@ -0,0 +1 @@ +Subproject commit 745291dcf20686ec421935f1c3f8f3a2918dd106 diff --git a/.config/zsh/shared.sh b/.config/zsh/shared.sh index 408819e..b7204f6 100644 --- a/.config/zsh/shared.sh +++ b/.config/zsh/shared.sh @@ -15,11 +15,6 @@ setopt HIST_REDUCE_BLANKS # Use NVIM alias vim=nvim -# NVM -export NVM_DIR="$CONFIGDIR/nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion - # Nodejs export SKIP_PREFLIGHT_CHECK=true diff --git a/.gitmodules b/.gitmodules index e7bdc7c..bca17c5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule ".config/zsh/plugins/catppuccin-zsh-syntax-highlighting"] path = .config/zsh/plugins/catppuccin-zsh-syntax-highlighting url = https://github.com/catppuccin/zsh-syntax-highlighting.git +[submodule ".config/zsh/plugins/zsh-nvm"] + path = .config/zsh/plugins/zsh-nvm + url = https://github.com/lukechilds/zsh-nvm.git diff --git a/.zshrc b/.zshrc index 4b550ad..57d72e0 100644 --- a/.zshrc +++ b/.zshrc @@ -15,3 +15,4 @@ source "$CONFIGDIR/zsh/shared.sh" # Load plugin related items source "$CONFIGDIR/zsh/plugins.sh" +