Featured image of post Ubuntu 20.04 终端插件配置与美化

Ubuntu 20.04 终端插件配置与美化

Zsh / oh-my-zsh / Powerlevel10k

​ 对 Linux 用户来说, 一个美观方便的终端可以提高很多工作效率.我所推荐的终端方案是 zsh + oh-my-zsh + Powerlevel10k ,兼顾美观与高效. 我所在的公司开发环境是 Ubuntu 20.04 , 本文就以这此发行版为例进行配置.

Zsh

安装 zsh

1
sudo apt install zsh

将 zsh 设置为默认 shell

1
chsh -s /bin/zsh

你可以用echo $SHELL 指令来查看当前的默认 shell 是否修改成功.

oh-my-zsh

安装 oh-my-zsh

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

安装一些实用插件

1
2
3
4
5
6
7
8
#自动补齐
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-autosuggestions

#语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-syntax-highlighting

#自动跳转
sudo apt-get install autojump

配置插件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
vim ~/.zshrc

#在 plugins 行添加插件名,如:
plusgins=(git zsh-autosuggestions zsh-syntax-highlighting)

#最后一行添加
. /usr/share/autojump/autojump.sh

#使配置生效
source ~/.zshrc

Powerlevel10k

安装 Powerlevel10k

1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

配置

1
2
3
vim ~/.zshrc
#修改 ZSH_THEME="powerlevel10k/powerlevel10k"
source ~/.zshrc

安装字体 (便于显示各种特殊符号和图表)

最后启动终端跟着向导配置,或者 p10k configure 就可以完成配置了.

Built with Hugo
Theme Stack designed by Jimmy