標簽:工具 主題
1、安裝完成之后的樣式
2、安裝iTerm2
我以前就裝過,所以這步驟略過。然后打開iTerm2,后面的操作全都在iterm2中完成。
3、安裝oh-my-zsh
安裝
curl方式安裝
$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
安裝失敗,轉而下載資源到本地進行安裝。
下載到本地進行安裝
$ cd ~
$ git clone https://github.com/robbyrussell/oh-my-zsh
$ cd ~/Downloads/ohmyzsh-master/tools
$ ./install.sh
- 安裝時遇到的問題:
-
解決方案:
-
如果Safari地址欄中鍵入:
github.com:443
后進入的Github
是自己的倉庫,那就退出登錄。如果出現的是Github
的登錄界面,那就登錄Github
。我采用這個方法就解決了上述問題。我猜測是因為我沒有給github設置SSH導致的。 -
終端
Clone
項目失敗就在Safari
上刷新GitHub
的網頁,如果網頁能刷新再繼續Clone。(WiFi刷新失敗可嘗試切換熱點)
-
-
安裝成功
安裝成功的截圖如下,這里折騰了好久,安裝成功給我高興壞了。
4、安裝Powerline
powerline的作用
Powerline插件主要解決很多關於 oh my zsh 主題中的字體問題,比如有特殊的表情和符號的主體出現的亂碼問題等。
安裝pip
安裝powerline之前需要安裝pip。
方案一
$ sudo easy_install pip
-
出現錯誤
SyntaxError: invalid syntax
換個方法安裝。
方案二
$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
$ sudo python3 get-pip.py
-
安裝成功
Successfully installed pip-22.0.4
安裝powerline-status
$ pip install powerline-status
-
安裝成功
Successfully installed powerline-status-2.7
5、安裝PowerFonts字體庫
下載字體庫
$ git clone https://github.com/powerline/fonts
安裝字體庫
進入fonts目錄下,執行查看是否有install.sh
文件,如果有按照下面步驟安裝Powerline的字體。
$ cd fonts/
$ ./install.sh
- 提示字體安裝成功
Powerline fonts installed to /Users/teresa/Library/Fonts
設置iTerm 2的字體
進入iTerm 2的設置里找到Profile
中的Text
,設置Font
的字體為Powerline的字體即可。
步驟:iTerm2 -> Preferences -> Profiles -> Text
6、配置配色方案
下載
$ git clone https://github.com/altercation/solarized
導入iTerm2中
進入剛剛下載的文件的./iterm2-colors-solarized
下雙擊 Solarized Dark.itermcolors
和 Solarized Light.itermcolors
把兩個配置文件導入到 iTerm2 里。
選擇配色方案
進入iTerm 2的設置里找到Profile
中的Color
,在color presets
中選擇Solarized Dark或者Solarized Light都可以。
步驟:iTerm2 -> Preferences -> Profiles -> Tolor
7、安裝主題
下載主題
$ git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor
安裝agnoster主題
運行install文件,主題將被自動安裝到~/.oh-my-zsh/themes
目錄下:
$ cd ~/Downloads/oh-my-zsh-agnoster-fcamblor-master
$ ./install
-
安裝時遇到的問題:
安裝時提示
~/.oh-my-zsh/themes/
目錄不存在,追溯后才發現是第一步zsh的安裝就失敗了。默默回去解決oh-my-zsh的安裝問題,如果地基沒打好,后面一定會困囿於各種奇怪的bug中。所以,一定要保證zsh以及它的配置的正確性哦~ -
配置
.zshrc
文件打開.zshrc文件
$ vi ~/.zshrc
配置
ZSH_THEME
=”agnoster“
,agnoster就是我們要用的主題。
ZSH_THEME=”agnoster“
安裝powerlevel9k主題
-
下載
這里我用了github的鏡像,不然打不開github。
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/themes/powerlevel9k
-
配置
.zshrc
文件ZSH_THEME=”powerlevel9k/powerlevel9k“
安裝powerlevel10k主題
-
下載&安裝
國內直接使用gitee.com的鏡像即可。
Just make sure to disable the current theme in your plugin manager.
指導手冊上要求先廢棄當前正在使用的主題,再安裝
powerlevel10k
。官方安裝指導如下:
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
我依然和前面安裝
powerlevel9k
的方式保持一致:git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k
-
配置
.zshrc
文件ZSH_THEME=”powerlevel10k/powerlevel10k“
經過一系列自定義模板的選擇后就可以進入iTerm2頁面啦,可選擇的模板特別多,我自己的定制模板深得我心,嘿嘿!
想了解更多使用方法,歡迎移步powerlevel10k官方。
8、設置高亮插件
下載插件
$ cd ~/.oh-my-zsh/custom/plugins
$ git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
配置.zshrc
文件
在plugins
中配置高亮插件,zsh-syntax-highlighting
必須放在末尾。
plugins=(
git
zsh-syntax-highlighting
)
在.zshrc
文件最后一行增加配置
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
9、配置命令補全
下載插件
$ cd ~/.oh-my-zsh/custom/plugins/
$ git clone https://github.com/zsh-users/zsh-autosuggestions
在.zshrc
文件中配置命令補全插件
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
10、iTerm2-Color-Schemes主題集的運用
iTerm2不僅支持 macOS 原生 Terminal.app
,還支持了包括 iTerm2、Konsole、PuTTY、Xresources、Termite、XFCE 和 Terminator 等app的主題。
下載地址
$ git clone https://github.com/mbadolato/iTerm2-Color-Schemes
配色方案
schemes
文件夾下面所有配色方案都可以用於iTerm2中
screenshots
文件夾中有配色圖片
適用於Mac 系統自帶的Terminal.app的主題
terminal
文件夾下面主題適用於Mac 系統自帶的Terminal.app
11、資料參考
本文參考以下眾多網友的文章,感謝網友們的分享。