- 查看当前环境shell
echo $SHELL
- 查看系统自带哪些shell
cat /etc/shells
- 如果没有
/bin/zsh
的话,安装zsh
yum install zsh # centos
brew install zsh # mac
- 将zsh设置为默认的shell
chsh -s /bin/zsh
再次确认下
echo $SHELL
看下当前默认shell有没有改,没有的话要重启终端。安装oh-my-zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
- 查看可用的主题
ls ~/.oh-my-zsh/themes
- 修改主题,编辑
~/.zshrc
ZSH_THEME="candy"
- 参考各种插件快捷键等
https://segmentfault.com/a/1190000013612471
- 安装自动补全插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc
加上插件补全命令只要输入前几个词,按⬆️按键就可以找历史记录
- 安装自动高亮插件
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
vi ~/.zshrc
请务必保证插件顺序,zsh-syntax-highlighting必须在最后一个。
然后在文件的最后一行添加:source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
总结:人不装逼会死