2016年5月26日 星期四

筆記:iTerm2使用Oh-My-Zsh

改成使用Zsh的最大原因是:美觀
雖然網路上也有很多心得分享.

1.先刪除原本的設定檔.
由於之前我有使用其他的設定檔, 先用ls來搜尋目標資料夾, 再利用rm指令把檔案刪除就可以回覆成初始設定.

2.安裝Zsh

$ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

3.選擇主題
安裝完之後,可以對主題/套件做一些調整,Oh-My-Zsh 的主題可以參考

主題/套件主要的設定在~/.zshrc

$ vim ~/.zshrc

修改的內容如下:

ZSH_THEME = "agnoster"
# 將 ZSH_THEME 設為主題的名稱,以 agnoster 主題為例
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# 中文設定的話要加上這兩行

4.調整字型
當完成主題設定重開iTerm時會顏色區塊中有出現“?”.
所以這裡就必須要調整字體的設定. 先下載背景顏色以及字體 選擇powerline字體

到 iTerm 的設定, 選擇 Profiles -> Colors -> Load Presets,選擇 Solarized Dark

enter image description here

點擊安裝完字體後, iTerm -> Preferences -> Profiles -> Text -> Change Font
兩個字體都選擇Change Font, 選擇下載的[Menlo for Powerline]即可.

enter image description here

如果用其他主題的話字體不必調整,請直接按照該主題的設定用就好了.

5.成果
enter image description here

參考網址:
1. http://v123582.github.io/blog/2015/12/06/MacOS-%E9%96%8B%E7%99%BC%E7%92%B0%E5%A2%83%E8%A8%AD%E5%AE%9A/
2. https://gist.github.com/kevin-smets/8568070
3. http://iphone4.tw/forums/showthread.php?t=206652