Post

Z Shell 让终端好看点(Zsh)

两个文档指路:

  1. Zsh https://www.zsh.org/

  2. On my zsh https://ohmyz.sh/

我用的 Ubuntu

安装 Zsh

1
2
3
4
# update package sources
sudo apt update && sudo apt upgrade -y
# install zsh git curl
sudo apt install zsh git curl -y

设置默认终端为 zsh

1
chsh -s /bin/zsh

安装 Oh my zsh

前提,你得先装 Zsh 哈哈

MethodCommand
curlsh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wgetsh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fetchsh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

插件安装(强烈推荐)

一个自动补全的,再一个语法高亮的

zsh -autosuggestions

Clone this repository into $ZSH_CUSTOM/plugins (by default ~/.oh-my-zsh/custom/plugins)

1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-syntax-highlighting

Clone the repository in the plugins directory of oh-my-zsh using

1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting)

Enable plugins

修改~/.zshrc中插件列表为:

1
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)

NOTE: elements in zsh arrays are separated by whitespace (spaces, tabs, newlines…). DO NOT use commas.

然后

1
source ~/.zshrc

成功

1
2
3
➜  ~ zsh --version
zsh 5.8 (x86_64-ubuntu-linux-gnu)
➜  ~ 
This post is licensed under CC BY 4.0 by the author.