1. 程式人生 > 其它 >mac系統下iTerms 的優化(oh-my-zsh 和 語法高亮)

mac系統下iTerms 的優化(oh-my-zsh 和 語法高亮)

參考資料 [https://www.v2ex.com/t/608399#reply136](前兩天答應的--打造高顏值的 iTerm2)
[https://cloud.tencent.com/developer/article/1684785](使用item2+oh my zsh優化終端體驗)

1.將 iTerm2 自帶 theme 修改為 Minimal ( Preferences-Appearance-General-Theme ) 以達到頂欄沉浸式的效果

2.下載主題 Dracula https://draculatheme.com/iterm/ 解壓後更換 Preferences-Profiles-Color-Color Presets-Import

3.開啟 Status bar

( Preferences-Profiles-Session-Status bar-Configure Status Bar ) 並根據自己的需求選擇要顯示的外掛

4.配置 ZSH 主題 Spaceship ZSH

Oh My ZSH 預設有很多主題,但今天要說的是可以跟 Powerlevel9k 相媲美的主題 Spaceship ZSH 按照官方文件進行安裝

oh-my-zsh
Clone this repo:

git clone https://github.com/spaceship-prompt/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1


Symlink spaceship.zsh-theme to your oh-my-zsh custom themes directory:

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme" Set ZSH_THEME="spaceship" in your .zshrc.

5.安裝 neofetch

6.宣告高亮外掛

安裝zsh-syntax-highlighting外掛,當遇到特殊命令和錯誤命令時會有高亮,需要使用Homebrew安裝:

brew install zsh-syntax-highlighting


安裝成功之後,使用命令vim ~/.zshrc進入編輯,找到plugins增加zsh-syntax-highlighting,並在最後一行增加下面配置:

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

如果出現下面這種情況zsh-syntax-highlighting not found,我們使用git方法下載檔案,重新啟動item2就好了

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting