美文网首页
zsh 最简化配置

zsh 最简化配置

作者: 无我_a50f | 来源:发表于2021-10-24 23:23 被阅读0次
1. 先安装zsh, on-my-zsh
sudo apt install zsh
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2.设置主题:
vi ~/.zshrc
#### 修改主题
ZSH_THEME="agnoster"
#### 安装 powerline 字体
sudo apt-get install fonts-powerline

主题 bira 也不错

3.设置zsh 不显示用户名和host
vi ~/.zshrc
#### 最后添加
-------------------------------------
prompt_context() {
    if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
        #prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
        prompt_segment black default "%(!.%{%F{yellow}%}.)"
    fi
}
------------------------------------
4. 安装 zsh-autosuggestions 插件
# clone 插件到 on-my-zsh 插件路径
git clone https://gitee.com/phpxxo/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# 修改 .zshrc 配置 插件
vi ~/.zshrc
---------------------------------------------------------------------
plugins=(git
        zsh-autosuggestions
        )

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=yellow'
----------------------------------------------------------------------
source ~/.zshrc

相关文章

网友评论

      本文标题:zsh 最简化配置

      本文链接:https://www.haomeiwen.com/subject/owadaltx.html