Ubuntu美化终端

安装zsh

1
sudo apt install zsh

安装oh my zsh

1
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

或者

1
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

如果出现443端口被拒,使用下面的指令

1
sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

或者

1
sh -c "$(wget -O- https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

安装zsh插件

进入oh-my-zsh的plugings文件夹

1
cd ~/.oh-my-zsh/custom/plugins/

安装zsh-autosuggestions

zsh-autosuggestions是一个补全插件,会根据输入的内容,关联出历史记录。按方向键右键,则会补全。

1
git clone https://github.com/zsh-users/zsh-autosuggestions

安装zsh-syntax-highlighting

zsh-syntax-highlighting是一个高亮插件,会高亮语法,合法的命令是绿色,不合法在的命令会报红。

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

配置环境

打开.zshrc文件,输入命令vim ~/.zshrc

找到如下代码

1
plugins=(git)

修改为

1
2
3
4
5
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

最后运行source ~/.zshrc命令,就可以生效了