Last active 5 hours ago

config.fish Raw
1set -g HISTSIZE 1000
2set -g HISTFILESIZE 2000
3# 环境变量设置
4# Java
5set -gx JAVA_HOME /usr/jvm/openjdk25/
6set -gx PATH $PATH $JAVA_HOME/bin
7set -gx CLASSPATH .:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
8set -gx JRE_HOME /$JAVA_HOME/jre
9
10# Bun
11set -gx BUN_INSTALL "$HOME/.bun"
12set -gx PATH $BUN_INSTALL/bin $PATH
13
14# 本地 bin
15set -gx PATH $HOME/.local/bin $PATH
16
17# nvm
18set --global nvm_data ~/.nvm
19set -gx nvm_default_version v24.13.0
20
21# 提醒别名 (alert 的 Fish 版本)
22function alert
23 set -l exit_code $status
24 set -l last_command (history | head -n1 | sed -E 's/^\s*[0-9]+\s+//')
25 if test $exit_code -eq 0
26 notify-send --urgency=low -i terminal "$last_command" "Command completed successfully"
27 else
28 notify-send --urgency=low -i error "$last_command" "Command failed with exit code $exit_code"
29 end
30end
31
32# 提示符设置 (Fish 的提示符通过 fish_prompt 函数配置)
33function fish_prompt
34 set -l last_status $status
35
36 # 获取 chroot 信息
37 set -l debian_chroot
38 if test -z "$debian_chroot" -a -r /etc/debian_chroot
39 set debian_chroot (cat /etc/debian_chroot)
40 end
41
42 # 设置颜色
43 set -l normal (set_color normal)
44 set -l green (set_color green)
45 set -l blue (set_color blue)
46
47 # 构建提示符
48 if set -q debian_chroot[1]
49 echo -n "($debian_chroot)"
50 end
51
52 echo -n $green(whoami)@(hostname -s)$normal:$blue(prompt_pwd)$normal
53 echo -n '$ '
54end
55
56# 终端标题设置
57function fish_title
58 # 获取当前目录名
59 set -q debian_chroot[1]; and set -l chroot "($debian_chroot)"
60 echo "$chroot"(whoami)@(hostname -s): (prompt_pwd)
61end
62
63# 自动补全增强 (Fish 默认已经很强大了)
64# 如果开启了 globstar 类似的功能,可以使用
65set -g fish_glob_star 1 # 启用 ** 匹配
66
67# 加载本地配置(如果存在)
68if test -f ~/.config/fish/local.fish
69 source ~/.config/fish/local.fish
70end