CentOS 7.9 安裝 zsh 及 配置 Oh my zsh
我們在通過[Shell]操作linux終端時,配置恼除、顏色區(qū)分踪旷、命令提示大都達不到我們預(yù)期的效果或者操作較為繁瑣。
安裝zsh并更改默認終端
1.安裝軟件包
yum -y install zsh git
2.更改默認終端
chsh -s /bin/zsh
這時候打開終端軟件豁辉,應(yīng)該就會默認進入 zsh 了令野。
配置oh-my-zsh
- 從igt倉庫中拉取oh-my-zsh
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh
- 默認配置
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
安裝高亮、自動補全插件
- 安裝高亮插件:zsh-syntax-highlighting
git clone https://gitee.com/dawnwords/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
-安裝自動補全:zsh-autosuggestions
git clone https://gitee.com/lhaisu/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- 安裝autojump目錄跳轉(zhuǎn)
git clone https://gitee.com/gentlecp/autojump.git cd autojump ./install.py
插件配置
同樣是打開.zshrc文件徽级,找到plugins=(git)气破,在這里增加自己想要的插件即可,多個插件名稱之間使用空格或者換行分開(不能使用逗號)
vim ~/.zshrc
plugins=(
git
sudo
zsh-autosuggestions
zsh-syntax-highlighting
autojump
)
每次修改完.zshrc都需要我們:
source ~./zshrc
默認的zsh主題很丑餐抢,可以在配置文件里面更改默認自帶的主題现使,可以修改
vim ~/.zshrc
找到ZSH_THEME,將其改為自己喜歡的主題旷痕,比如maran,或者agnoster碳锈,這兩個比較好看。
刷新zsh配置文件 source ~/.zshrc