先看炫酷的效果
炫酷shell 任选
命令行高亮,一眼确认是否有误
自动补全是真香,不多说看下图:
安装zsh
sudo apt install -y zsh
zsh --version
安装oh-my-zsh
#curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
#或者通过wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
如果github访问问题可使用gitee源
#curl
sh -c "$(curl -fsSL https://gitee.com/gloriaied/oh-my-zsh/raw/master/tools/install.sh)"
#wget
sh -c "$(wget https://gitee.com/gloriaied/oh-my-zsh/raw/master/tools/install.sh -O -)"
安装成功提示如下:
设为默认shell
#查看Linux安装的所有shell
cat /etc/shells
#zsh设为默认shell
chsh -s /bin/zsh
#检查是否设置成功
echo $SHELL
设置主题
根据个人喜好配置主题,当前默认为ZSH_THEME=“robbyrussell”,这里修改为ys,也可以设置为随机random
#查看所有主题
ls .oh-my-zsh/themes
#编辑.zshrc文件配置主题
nano ~/.zshrc
#重新加载配置文件,使其生效
source ~/.zshrc
安装语法高亮插件
#github
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
#github 不行,用gitee
git clone https://gitee.com/gloriaied/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
编辑 .zshrc 文件,定位到plugins,新增:zsh-syntax-highlighting
# 修改配置文件
nano ~/.zshrc
# 重新加载配置文件
source ~/.zshrc
安装输入命令行时自动补全
#github
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
#github 不行,用gitee
git clone https://gitee.com/gloriaied/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
编辑 .zshrc 文件,定位到plugins,新增:zsh-autosuggestions
# 修改配置文件
vim ~/.zshrc
# 重新加载配置文件
source ~/.zshrc