(.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-autosuggestions
zsh-syntax-highlighting
history-substring-search
systemd
k
extract
sudo
# history-substring-search
# systemd
# k
# extract
# sudo
fzf-tab
# web-search
# httpie

View File

@@ -1,4 +1,17 @@
# Initialize nvm (Node Version Manager)
export NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.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
export NVM_DIR="$HOME/.nvm"
nvm() {
unset -f nvm
[ -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 "$@"
}