Linux安裝Oh-my-zsh


一、安裝步驟:

1.安裝zsh

yum install zsh

2.安裝git

yum install git

3.下載oh-my-zsh的安裝腳本

  • 安裝wget(centos7默認是沒有的)
yum install wget

4.下載 zsh 安裝腳本

  • 我這里因為用 github 源無法下載,一直卡在 clone into "xxx",所以改換了國內的鏡像源
# gitee 源
wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

5.編輯 install.sh

找到以下部分

# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}

REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}

替換為

REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
  1. 編輯后保存, 運行安裝即可. (運行前先給install.sh權限)
# 賦予可執行權限
chmod +x install.sh
# 運行
sh install.sh
  1. 修改倉庫地址
cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull

二、切換為 zsh

  1. 輸入cat /etc/shells命令來查看本地安裝的shell
/bin/sh
/bin/bash
/usr/bin/sh
/usr/bin/bash
/bin/tcsh
/bin/csh
/bin/zsh
  1. 切換sehll至zsh
chsh -s /bin/zsh
  1. 查看當前使用的shell
echo $SHELL

三、oh-my-zsh插件設置

  1. 編輯主題和插件
vim ~/.zshrc
  • 修改主題:找到下面設置主題的部分,修改引號中的名稱即可(比如我這里用的 ys 主題)
ZSH_THEME="ys"
  • 修改插件:找到插件的部分,直接修改,常用的插件可以自行參考網上其他文章
plugins=(git
sublime
z
web-search
wd
zsh-autosuggestions
extract
zsh-syntax-highlighting)
  1. 刷新配置文件
source ~/.zshrc
  • 在刷新配置的過程中,提示zsh-autosuggestions、zsh-syntax-highlighting 插件 not found,可通過單獨下載解決(下載后再次刷新配置文件):
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM