查看当前shell

1
echo $SHELL 
1
cat /etc/shells 

安装zsh

1
yum -y install zsh

安装oh-my-zsh

1
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

成功界面

1
2
3
4
5
6
7
8
9
10
  ____  / /_     ____ ___  __  __   ____  _____/ /_  
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.

p.s. Follow us at https://twitter.com/ohmyzsh.

p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.

配置主题

1
2
3
4
5
vim ~/.zshrc

ZSH_THEME="agnoster"

source ~/.zshrc

agnoster乱码问题

1
2
3
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh # Windows ./install.ps1

vscode配置字体

首选项-设置-搜索font

填入 Noto Mono for powerline

incr自动补全插件

下载

1
2
3
mkdir ~/.oh-my-zsh/plugins/incr
cd ~/.oh-my-zsh/plugins/incr
wget http://mimosa-pudica.net/src/incr-0.2.zsh

~/.zshrc 最后一行加上

1
source ~/.oh-my-zsh/plugins/incr/incr*.zsh

启用

1
source ~/.zshrc

效果

zsh bash 切换

1
chsh -s /bin/bash
1
chsh -s /bin/zsh

clash

vim ~/.zshrc

1
2
export clashdir="/etc/clash"
alias clash="bash /etc/clash/clash.sh"

git文件夹下命令慢

可能是因为git项目太大,zsh需要检查每个文件的状态以显示git状态,所以很慢

解决办法,不让zsh显示git状态

1
git config --global --add oh-my-zsh.hide-status 1