if status is-interactive # ========= 命令缩写(仅当目标命令存在)========= # ls:优先 eza,其次 exa if type -q eza abbr ls eza abbr ll eza -l abbr la eza -a abbr lal eza -la else if type -q exa abbr ls exa abbr ll exa -l abbr la exa -a abbr lal exa -la end # cat/cap:优先 bat;仅 batcat 时补 bat 缩写(与其它环境一致) if type -q bat abbr cat bat abbr cap bat -p else if type -q batcat abbr cat batcat abbr cap batcat -p abbr bat batcat end # find:优先 fd;仅存在 fdfind 时(如 Debian/Ubuntu)用其并补 fd 缩写 if type -q fd abbr find fd else if type -q fdfind abbr find fdfind abbr fd fdfind end type -q rg; and abbr grep rg type -q btop; and abbr top btop type -q tldr; and abbr help tldr type -q chezmoi; and abbr cz chezmoi type -q tmux; and abbr tm tmux type -q tmux; and abbr tmn 'tmux new' type -q tmux; and abbr tma 'tmux attach' type -q tmux; and abbr tml 'tmux list-sessions' # ========= thefuck:自动命令纠错 ========= type -q thefuck; and thefuck --alias | source # ========= zoxide:智能目录跳转 ========= # 使用 --cmd=cd:让 cd 也具备 zoxide 的跳转能力(交互式对应 cdi) type -q zoxide; and zoxide init --cmd=cd fish | source # ========= 编辑器/查看器(优先 vim,否则 vi)========= # SUDO_EDITOR:供 visudo / sudoedit 等使用;若仍打开 nano,需在 sudoers 中加 Defaults env_keep += "SUDO_EDITOR" if type -q vim set -gx EDITOR vim set -gx VISUAL vim set -gx SUDO_EDITOR vim else if type -q vi set -gx EDITOR vi set -gx VISUAL vi set -gx SUDO_EDITOR vi end # ========= fastfetch:启动信息显示 ========= type -q fastfetch; and fastfetch end