- 安装zsh
sudo apt-get install -y zsh
如果出现文件依赖错误,根据提示执行
sudo apt --fix-broken install
2.安装oh-my-zsh
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
3.从模板文件复制 .zshrc 创建默认配置文件(新用户将使用该配置文件)
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
4.指定zsh为默认shell
chsh -s /bin/zsh
5.启动zsh
source ~/.zshrc
6.重启电脑,可以使用zsh
ps:一些好用的插件
zsh-autosuggestions:记录之前输入过的指令,并自动匹配自己可能要的指令,按→补全
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting:提示当前输入的命令是否正确,正确为绿色,错误为红色
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
如何使用插件???
打开.zshrc
vim ~/.zshrc
在plugins=(git)处添加安装好的插件,插件用空格隔开
例如我当前的配置
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
完