一、安裝基本組件
首先執(zhí)行 yum
命令來安裝需要的 zsh
原始程序與 git
程序來 pull
代碼。
安裝 oh my zsh
腳本 (這一步需要安裝 git
)。
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
使用 which zsh
查看 zsh
的安裝目錄,一般都存儲在 /usr/bin/zsh
目錄下。
使用 chsh
命令切換使用的 shell 程序。
二、進行可選配置
2.1 安裝 ZSH 圖標字體
執(zhí)行以下命令在當前目錄拉取圖標的倉庫,并切換到其目錄下,執(zhí)行 ./install.sh
腳本即可安裝成功。
git clone https://github.com/powerline/fonts.git
2.2 更換 ZSH 主題
使用 vi
工具編輯 /root/.zshrc
文件,更改 ZSH_THEME="robbyussell"
字段為 ZSH_THEME="agnoster"
字段,并通過 source ~/.zshrc
命令更新它們的配置文件。
2.3 安裝插件
使用 ZSH 替換原有的 SHELL 最主要的原因就是要使用其功能強大的插件,這里只推薦安裝三個插件,它們分別是 wd
、zsh-syntax-highlighting
、zsh-autosuggestions
。
首先依次執(zhí)行下列的命令,將后面兩個插件的倉庫克隆到 Oh My Zsh 的插件目錄下。
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
git clone https://github.com/zsh-users/zsh-autosuggestions.git
完成克隆操作之后,那么兩個插件的全路徑分別是:
/root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-syntax-highlighting.zsh
/root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
繼續(xù)使用 vi
編輯 ~/.zshrc
文件。
# 其他內容
plugins=(
git
wd
zsh-syntax-highlighting
zsh-autosuggestions
)
source /root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-syntax-highlighting.zsh
source /root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source $ZSH/oh-my-zsh.sh
# 其他內容
編輯完成之后,執(zhí)行 source ~/.zshrc
命令更新 ZSH 配置,最后的效果如下圖。
總結
以上所述是小編給大家介紹的CentOS 7.x 安裝 ZSH 終端的配置方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉載,煩請注明出處,謝謝!