set -g HISTSIZE 1000 set -g HISTFILESIZE 2000 # 环境变量设置 # Java set -gx JAVA_HOME /usr/jvm/openjdk25/ set -gx PATH $PATH $JAVA_HOME/bin set -gx CLASSPATH .:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH set -gx JRE_HOME /$JAVA_HOME/jre # Bun set -gx BUN_INSTALL "$HOME/.bun" set -gx PATH $BUN_INSTALL/bin $PATH # 本地 bin set -gx PATH $HOME/.local/bin $PATH # nvm set --global nvm_data ~/.nvm set -gx nvm_default_version v24.13.0 # 提醒别名 (alert 的 Fish 版本) function alert set -l exit_code $status set -l last_command (history | head -n1 | sed -E 's/^\s*[0-9]+\s+//') if test $exit_code -eq 0 notify-send --urgency=low -i terminal "$last_command" "Command completed successfully" else notify-send --urgency=low -i error "$last_command" "Command failed with exit code $exit_code" end end # 提示符设置 (Fish 的提示符通过 fish_prompt 函数配置) function fish_prompt set -l last_status $status # 获取 chroot 信息 set -l debian_chroot if test -z "$debian_chroot" -a -r /etc/debian_chroot set debian_chroot (cat /etc/debian_chroot) end # 设置颜色 set -l normal (set_color normal) set -l green (set_color green) set -l blue (set_color blue) # 构建提示符 if set -q debian_chroot[1] echo -n "($debian_chroot)" end echo -n $green(whoami)@(hostname -s)$normal:$blue(prompt_pwd)$normal echo -n '$ ' end # 终端标题设置 function fish_title # 获取当前目录名 set -q debian_chroot[1]; and set -l chroot "($debian_chroot)" echo "$chroot"(whoami)@(hostname -s): (prompt_pwd) end # 自动补全增强 (Fish 默认已经很强大了) # 如果开启了 globstar 类似的功能,可以使用 set -g fish_glob_star 1 # 启用 ** 匹配 # 加载本地配置(如果存在) if test -f ~/.config/fish/local.fish source ~/.config/fish/local.fish end