refactor(zsh): 移除 oh-my-zsh 依赖,改用原生配置

This commit is contained in:
2026-04-08 10:45:09 +08:00
parent b1dd39f54e
commit 885926335f
3 changed files with 17 additions and 13 deletions
+13 -12
View File
@@ -6,28 +6,28 @@ setopt AUTO_CD # 输目录名直接 cd
setopt INTERACTIVE_COMMENTS # 允许交互式 # 注释
setopt NO_BEEP # 关蜂鸣
# ── Oh My Zsh ──
ZSH=/usr/share/oh-my-zsh/
ZSH_THEME="" # Starship 接管提示符
plugins=(
git # git 别名(gst, gco, gp...
sudo # 双击 ESC 自动加 sudo
extract # x file.tar.gz 一键解压任何格式
direnv # direnv hook
)
ZSH_CACHE_DIR=$HOME/.cache/oh-my-zsh
[[ ! -d $ZSH_CACHE_DIR ]] && mkdir -p $ZSH_CACHE_DIR
source $ZSH/oh-my-zsh.sh
# ── 补全系统(必须在 fzf-tab 之前)──
autoload -Uz compinit && compinit
# ── 外部插件 ──
source /usr/share/zsh/plugins/fzf-tab-git/fzf-tab.plugin.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # 必须最后
# ── 双击 ESC 自动加 sudo ──
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
zle end-of-line
}
zle -N sudo-command-line
bindkey '\e\e' sudo-command-line
# ── 工具初始化(顺序重要)──
eval "$(starship init zsh)"
eval "$(zoxide init zsh)"
eval "$(mise activate zsh)"
eval "$(direnv hook zsh)"
eval "$(fzf --zsh)" # Ctrl+T 搜文件, Alt+C 搜目录
eval "$(atuin init zsh)" # 必须在 fzf 之后,接管 Ctrl+R
@@ -49,6 +49,7 @@ alias cat="bat --paging=never"
alias rm="trash-put"
alias lg="lazygit"
alias vi="nvim"
alias x="aunpack" # 万能解压(支持 tar/zip/7z/rar 等)
# 网络
alias http="xh"