feat: support nvm(fnm)
This commit is contained in:
@@ -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
|
||||
|
||||
+13
-1
@@ -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 <command>"
|
||||
|
||||
Reference in New Issue
Block a user