外观
Zsh设置
168字小于1分钟
2025-04-25
安装 zsh
sudo apt update
sudo apt install zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
git clone https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
配置 zsh
# 主题修改
ZSH_THEME="powerlevel10k/powerlevel10k"
# 插件配置
plugins=(git z sudo zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search)
# 历史命令设置
HISTSIZE=10000
SAVEHIST=10000
setopt HIST_IGNORE_ALL_DUPS
# 自动补全设置
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
# 按键绑定
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
默认终端
chsh -s $(which zsh)
重新登录