Last active 7 hours ago

santisify's Avatar santisify revised this gist 7 hours ago. Go to revision

1 file changed, 70 insertions

config.fish(file created)

@@ -0,0 +1,70 @@
1 + set -g HISTSIZE 1000
2 + set -g HISTFILESIZE 2000
3 + # 环境变量设置
4 + # Java
5 + set -gx JAVA_HOME /usr/jvm/openjdk25/
6 + set -gx PATH $PATH $JAVA_HOME/bin
7 + set -gx CLASSPATH .:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
8 + set -gx JRE_HOME /$JAVA_HOME/jre
9 +
10 + # Bun
11 + set -gx BUN_INSTALL "$HOME/.bun"
12 + set -gx PATH $BUN_INSTALL/bin $PATH
13 +
14 + # 本地 bin
15 + set -gx PATH $HOME/.local/bin $PATH
16 +
17 + # nvm
18 + set --global nvm_data ~/.nvm
19 + set -gx nvm_default_version v24.13.0
20 +
21 + # 提醒别名 (alert 的 Fish 版本)
22 + function 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
30 + end
31 +
32 + # 提示符设置 (Fish 的提示符通过 fish_prompt 函数配置)
33 + function 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 '$ '
54 + end
55 +
56 + # 终端标题设置
57 + function fish_title
58 + # 获取当前目录名
59 + set -q debian_chroot[1]; and set -l chroot "($debian_chroot)"
60 + echo "$chroot"(whoami)@(hostname -s): (prompt_pwd)
61 + end
62 +
63 + # 自动补全增强 (Fish 默认已经很强大了)
64 + # 如果开启了 globstar 类似的功能,可以使用
65 + set -g fish_glob_star 1 # 启用 ** 匹配
66 +
67 + # 加载本地配置(如果存在)
68 + if test -f ~/.config/fish/local.fish
69 + source ~/.config/fish/local.fish
70 + end
Newer Older