From 1fe69f6c95cd77e32fc49d2ecc65f6d0350c9ba4 Mon Sep 17 00:00:00 2001 From: laily Date: Fri, 28 Nov 2025 16:16:36 +0800 Subject: [PATCH] feat: support nvm(fnm) --- fish/config.fish | 15 +++++++++++++++ fish/functions/ff.fish | 14 +++++++++++++- golang/golangci.yml | 4 ++-- iterm2/com.googlecode.iterm2.plist | 2 ++ script/nvm-install.sh | 4 ++++ vscode/settings.json | 3 ++- 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 script/nvm-install.sh diff --git a/fish/config.fish b/fish/config.fish index ad243e2..9022cba 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -23,6 +23,14 @@ function add_to_path end end +function is_command_exists + if command -v $argv[1] >/dev/null 2>&1 + return 0 + else + return 1 + end +end + # set environment set paths_to_check /usr/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/bin /opt/sbin /usr/syno/sbin /usr/syno/bin /usr/local/sbin $HOME/.local/bin for path in $paths_to_check do @@ -165,3 +173,10 @@ if not string match -q -- $PNPM_HOME $PATH set -gx PATH "$PNPM_HOME" $PATH end # pnpm end + + +############################################################ +if is_command_exists fnm + alias nvm="fnm" + fnm env --use-on-cd --shell fish | source +end diff --git a/fish/functions/ff.fish b/fish/functions/ff.fish index 5f2e565..dff84d2 100644 --- a/fish/functions/ff.fish +++ b/fish/functions/ff.fish @@ -4,7 +4,8 @@ function ff set -l commands \ "reload|Reload fish configuration" \ "edit|Edit custom fish configuration" \ - "cd|Change to fish config directory" \ + "fish|Change to fish config directory" \ + "dotfile|Change to dotfile directory" \ "pon|Enable proxy (proxy on)" \ "poff|Disable proxy (proxy off)" \ "pst|Show proxy status" \ @@ -13,6 +14,14 @@ function ff "update|Update dotfile" \ "help|Show this help message" + # 确保 execute-script 可用(在 fish 自动加载前手动引入一次) + if not functions -q execute-script + set -l execute_script_path ~/.dotfile/fish/functions/execute-script.fish + if test -f $execute_script_path + source $execute_script_path + end + end + switch $argv[1] case reload source ~/.config/fish/config.fish @@ -51,6 +60,9 @@ function ff echo "Error: Dotfile directory not found at $dotfile_dir" end case script + if not functions -q execute-script + source ~/.dotfile/fish/functions/execute-script.fish + end execute-script $argv[2..-1] case help echo "Usage: ff " diff --git a/golang/golangci.yml b/golang/golangci.yml index a6de451..c5e8b46 100644 --- a/golang/golangci.yml +++ b/golang/golangci.yml @@ -52,7 +52,7 @@ linters: disabled: false - name: cognitive-complexity arguments: - - 20 + - 25 severity: warning disabled: false - name: constant-logical-expr @@ -66,7 +66,7 @@ linters: disabled: false - name: cyclomatic arguments: - - 20 + - 25 severity: warning disabled: false - name: datarace diff --git a/iterm2/com.googlecode.iterm2.plist b/iterm2/com.googlecode.iterm2.plist index 20703fc..ca21291 100644 --- a/iterm2/com.googlecode.iterm2.plist +++ b/iterm2/com.googlecode.iterm2.plist @@ -1461,6 +1461,8 @@ Print In Black And White + ShowFullScreenTabBar + SoundForEsc VisualIndicatorForEsc diff --git a/script/nvm-install.sh b/script/nvm-install.sh new file mode 100644 index 0000000..f90de09 --- /dev/null +++ b/script/nvm-install.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# https://github.com/Schniz/fnm +curl -fsSL https://fnm.vercel.app/install | bash \ No newline at end of file diff --git a/vscode/settings.json b/vscode/settings.json index 613da0d..3bee7bb 100644 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -266,5 +266,6 @@ }, "git.confirmSync": false, "editor.dropIntoEditor.preferences": [], - "whichkey.bindingOverrides": [] + "whichkey.bindingOverrides": [], + "cursor.general.disableHttp2": true }