Compare commits

...

2 Commits

Author SHA1 Message Date
e1117a254c 重构 fish 配置,优化工具选择和缩写逻辑 2026-04-02 15:38:05 +08:00
7e0f85bd5e 添加 README.md 2026-04-02 15:37:52 +08:00
2 changed files with 48 additions and 46 deletions

18
dot_config/README.md Normal file
View File

@@ -0,0 +1,18 @@
# Dotfiles 工具列表
## Bash 常用命令增强/替代
- **zoxide** - 智能目录跳转
- **eza / exa** - 替代 `ls`
- **bat / batcat** - 替代 `cat`
- **fd / fdfind** - 替代 `find`
- **ripgrep (rg)** - 替代 `grep`
- **btop** - 替代 `top`
- **tldr** - 替代 `man`
## 其他工具
- **Fish Shell** - 现代化 shell
- **Tmux** - 终端复用器
- **Git** - 版本控制
- **vim** - 文本编辑器
- **fastfetch** - 系统信息显示
- **thefuck** - 命令纠错

View File

@@ -1,37 +1,35 @@
if status is-interactive if status is-interactive
# ========= 命令缩写(仅当目标命令存在)========= # ========= 编辑器环境变量设置 ==========
# ls优先 eza其次 exa set -l editor_cmd (if type -q vim; echo vim; else if type -q vi; echo vi; else; end)
if type -q eza test -n "$editor_cmd"; and set -gx EDITOR $editor_cmd
abbr ls eza test -n "$editor_cmd"; and set -gx VISUAL $editor_cmd
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 缩写(与其它环境一致) # ========= Bash 常用命令增强/替代 ==========
if type -q bat # 工具选择
abbr cat bat set -l ls_cmd (if type -q eza; echo eza; else if type -q exa; echo exa; else; end)
abbr cap bat -p set -l cat_cmd (if type -q bat; echo bat; else if type -q batcat; echo batcat; else; end)
else if type -q batcat set -l find_cmd (if type -q fd; echo fd; else if type -q fdfind; echo fdfind; else; end)
abbr cat batcat
abbr cap batcat -p # 处理特殊情况:根据选择的工具添加缩写
abbr bat batcat test "$cat_cmd" = "batcat"; and abbr bat batcat
end test "$find_cmd" = "fdfind"; and abbr fd fdfind
# find优先 fd仅存在 fdfind 时(如 Debian/Ubuntu用其并补 fd 缩写
if type -q fd # 使用 --cmd=cd让 cd 也具备 zoxide 的跳转能力(交互式对应 cdi
abbr find fd type -q zoxide; and zoxide init --cmd=cd fish | source
else if type -q fdfind
abbr find fdfind # 命令缩写配置
abbr fd fdfind test -n "$ls_cmd"; and abbr ls $ls_cmd
end test -n "$ls_cmd"; and abbr ll "$ls_cmd -l"
test -n "$ls_cmd"; and abbr la "$ls_cmd -a"
test -n "$ls_cmd"; and abbr lal "$ls_cmd -la"
test -n "$cat_cmd"; and abbr cat $cat_cmd
test -n "$cat_cmd"; and abbr cap "$cat_cmd -p"
test -n "$find_cmd"; and abbr find $find_cmd
type -q rg; and abbr grep rg type -q rg; and abbr grep rg
type -q btop; and abbr top btop type -q btop; and abbr top btop
type -q tldr; and abbr help tldr type -q tldr; and abbr help tldr
# ========= 其他工具配置 ==========
type -q chezmoi; and abbr cz chezmoi type -q chezmoi; and abbr cz chezmoi
type -q tmux; and abbr tm tmux type -q tmux; and abbr tm tmux
type -q tmux; and abbr tmn 'tmux new' type -q tmux; and abbr tmn 'tmux new'
@@ -41,22 +39,8 @@ if status is-interactive
# ========= thefuck自动命令纠错 ========= # ========= thefuck自动命令纠错 =========
type -q thefuck; and thefuck --alias | source type -q thefuck; and thefuck --alias | source
# ========= zoxide智能目录跳转 ========= # ========= fastfetch启动信息显示仅在第一次打开 shell 时) =========
# 使用 --cmd=cd让 cd 也具备 zoxide 的跳转能力(交互式对应 cdi if status --is-login; and type -q fastfetch
type -q zoxide; and zoxide init --cmd=cd fish | source fastfetch
# ========= 编辑器/查看器(优先 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 end
# ========= fastfetch启动信息显示 =========
type -q fastfetch; and fastfetch
end end