feat: support nvm(fnm)
This commit is contained in:
@@ -23,6 +23,14 @@ function add_to_path
|
|||||||
end
|
end
|
||||||
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 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
|
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
|
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
|
set -gx PATH "$PNPM_HOME" $PATH
|
||||||
end
|
end
|
||||||
# pnpm end
|
# pnpm end
|
||||||
|
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
if is_command_exists fnm
|
||||||
|
alias nvm="fnm"
|
||||||
|
fnm env --use-on-cd --shell fish | source
|
||||||
|
end
|
||||||
|
|||||||
+13
-1
@@ -4,7 +4,8 @@ function ff
|
|||||||
set -l commands \
|
set -l commands \
|
||||||
"reload|Reload fish configuration" \
|
"reload|Reload fish configuration" \
|
||||||
"edit|Edit custom 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)" \
|
"pon|Enable proxy (proxy on)" \
|
||||||
"poff|Disable proxy (proxy off)" \
|
"poff|Disable proxy (proxy off)" \
|
||||||
"pst|Show proxy status" \
|
"pst|Show proxy status" \
|
||||||
@@ -13,6 +14,14 @@ function ff
|
|||||||
"update|Update dotfile" \
|
"update|Update dotfile" \
|
||||||
"help|Show this help message"
|
"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]
|
switch $argv[1]
|
||||||
case reload
|
case reload
|
||||||
source ~/.config/fish/config.fish
|
source ~/.config/fish/config.fish
|
||||||
@@ -51,6 +60,9 @@ function ff
|
|||||||
echo "Error: Dotfile directory not found at $dotfile_dir"
|
echo "Error: Dotfile directory not found at $dotfile_dir"
|
||||||
end
|
end
|
||||||
case script
|
case script
|
||||||
|
if not functions -q execute-script
|
||||||
|
source ~/.dotfile/fish/functions/execute-script.fish
|
||||||
|
end
|
||||||
execute-script $argv[2..-1]
|
execute-script $argv[2..-1]
|
||||||
case help
|
case help
|
||||||
echo "Usage: ff <command>"
|
echo "Usage: ff <command>"
|
||||||
|
|||||||
+2
-2
@@ -52,7 +52,7 @@ linters:
|
|||||||
disabled: false
|
disabled: false
|
||||||
- name: cognitive-complexity
|
- name: cognitive-complexity
|
||||||
arguments:
|
arguments:
|
||||||
- 20
|
- 25
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
- name: constant-logical-expr
|
- name: constant-logical-expr
|
||||||
@@ -66,7 +66,7 @@ linters:
|
|||||||
disabled: false
|
disabled: false
|
||||||
- name: cyclomatic
|
- name: cyclomatic
|
||||||
arguments:
|
arguments:
|
||||||
- 20
|
- 25
|
||||||
severity: warning
|
severity: warning
|
||||||
disabled: false
|
disabled: false
|
||||||
- name: datarace
|
- name: datarace
|
||||||
|
|||||||
@@ -1461,6 +1461,8 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<key>Print In Black And White</key>
|
<key>Print In Black And White</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>ShowFullScreenTabBar</key>
|
||||||
|
<false/>
|
||||||
<key>SoundForEsc</key>
|
<key>SoundForEsc</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>VisualIndicatorForEsc</key>
|
<key>VisualIndicatorForEsc</key>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://github.com/Schniz/fnm
|
||||||
|
curl -fsSL https://fnm.vercel.app/install | bash
|
||||||
@@ -266,5 +266,6 @@
|
|||||||
},
|
},
|
||||||
"git.confirmSync": false,
|
"git.confirmSync": false,
|
||||||
"editor.dropIntoEditor.preferences": [],
|
"editor.dropIntoEditor.preferences": [],
|
||||||
"whichkey.bindingOverrides": []
|
"whichkey.bindingOverrides": [],
|
||||||
|
"cursor.general.disableHttp2": true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user