zsh的配置安装

安装zsh

查看系统当前使用的shell

1
2
$ echo $SHELL 
/bin/bash

查看系统是否安装了zsh

1
2
3
4
5
6
7
8
9
$ cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh

安装zsh

1
sudo apt install zsh

切换shell为zsh

1
2
3
$ chsh -s /bin/zsh
Changing shell for root.
Shell changed.

重启服务器后,可使用reboot

安装 oh my zsh

1
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

如果连不上,克隆到码云再试

插件安装

zsh-syntax-highlighting

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

zsh-autosuggestions

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

zsh-completions

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

zsh-history-substring-search

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