Skip to content

安装并配置Zsh

安装Zsh

sudo apt-get install zsh

默认的Shell改成zsh

chsh -s /bin/zsh

注意:不要使用sudo。

  • 如果chsh: PAM认证失败,配置密码文件:
sudo vi /etc/passwd

把对应用户/bin/bash改成/bin/zsh

安装Git

sudo apt-get install git

安装oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

安装插件

sudo apt-get install autojump
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

修改~/.zshrc

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

然后增加在 ~/.zshrc 最后一行:

source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH_CUSTOM/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

配置主题

此处以我使用的主题为例,更多主题可以在Themes · ohmyzsh/ohmyzsh Wiki · GitHub找到并自行修改

git clone  https://github.com/Egolas/agnosterj-zsh-theme

ln -s ~/agnosterj-zsh-theme/agnosterj.zsh-theme $ZSH/themes/agnosterj.zsh-theme

修改~/.zshrc

vi ~/.zshrc

找到对应位置并修改:

ZSH_THEME="agnosterj"

生效:

source ~/.zshrc

可能遇到的问题

conda环境提示显示冗余

conda config --set changeps1 False