(.zshrc, nvm.zsh): comment out unused plugins in .zshrc and refactor nvm initialization to improve function handling for nvm, node, and npm commands

This commit is contained in:
Frank Qing
2025-06-06 00:15:07 +08:00
parent 3b820fce60
commit 3d5cf87929
2 changed files with 22 additions and 9 deletions

10
.zshrc
View File

@@ -69,11 +69,11 @@ plugins=(
# zsh-completions INSTALL METHOD CHANGED https://github.com/zsh-users/zsh-completions/issues/603 # zsh-completions INSTALL METHOD CHANGED https://github.com/zsh-users/zsh-completions/issues/603
zsh-autosuggestions zsh-autosuggestions
zsh-syntax-highlighting zsh-syntax-highlighting
history-substring-search # history-substring-search
systemd # systemd
k # k
extract # extract
sudo # sudo
fzf-tab fzf-tab
# web-search # web-search
# httpie # httpie

View File

@@ -1,4 +1,17 @@
# Initialize nvm (Node Version Manager) export NVM_DIR="$HOME/.nvm"
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.nvm}" nvm() {
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm unset -f nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm "$@"
}
node() {
unset -f node
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
node "$@"
}
npm() {
unset -f npm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm "$@"
}