From 3d5cf87929aa10b585bfe79ffc06471d04a63b77 Mon Sep 17 00:00:00 2001 From: Frank Qing Date: Fri, 6 Jun 2025 00:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(.zshrc,=20nvm.zsh):=20comment=20ou?= =?UTF-8?q?t=20unused=20plugins=20in=20.zshrc=20and=20refactor=20nvm=20ini?= =?UTF-8?q?tialization=20to=20improve=20function=20handling=20for=20nvm,?= =?UTF-8?q?=20node,=20and=20npm=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .zshrc | 10 +++++----- zshrc/nvm.zsh | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.zshrc b/.zshrc index de20eb6..2cbd6fe 100644 --- a/.zshrc +++ b/.zshrc @@ -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 diff --git a/zshrc/nvm.zsh b/zshrc/nvm.zsh index 8a4849d..e63dcfb 100644 --- a/zshrc/nvm.zsh +++ b/zshrc/nvm.zsh @@ -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 "$@" +} \ No newline at end of file