0%

wsl-terminal-beautify

Linux 默认终端丑不拉几的,几乎没法看。高亮不足,提示不全,颜值太 low 影响视觉。终极优化方案zsh + oh-my-zsh + powerlevel10k大大提升用户体验感。

如下图所示,图来自 powerlevel10k 官方
performance.gif

安装 zsh

1
2
3
4
5
# zsh
sudo apt-get install zsh

# 修改默认shell 为zsh 注意不要用sudo
chsh -s /bin/zsh

安装  oh-my-zsh & 主题

1
2
3
4
5
# 官方安装脚本
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 下载主题 powerlevel10k主题:https://github.com/romkatv/powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k

配置 oh-my-zsh

1
2
3
4
5
6
7
8
9
10
11
12
13
vi ~/.zshrc

## 修改主题配置为
ZSH_THEME="powerlevel10k/powerlevel10k"

## 修改插件配置为
plugins=(git git-open zsh-autosuggestions zsh-syntax-highlighting)

## git-open 配置 alias 可以直接在终端输入go 就打开远程仓库地址
alias go="git-open"

## 修改完毕,保存退出后执行
source ~/.zshrc

配置  powerlevel10k

1
p10k configure

configuration-wizard.gif

有可能需要安装字体

https://github.com/romkatv/powerlevel10k#fonts

常用插件

插件 作用
zsh-syntax-highlighting 代码高亮 https://github.com/zsh-users/zsh-syntax-highlighting
zsh-autosuggestions 自动补全 https://github.com/zsh-users/zsh-autosuggestions
git-open open 仓库 https://github.com/paulirish/git-open