以前一直使用的是mac自帶的終端,因爲以前命令操做較少,也就無所謂了。可是如今隨着命令行操做的頻繁,原有的終端開發效率過低,偶然發現了iTerm2,發現功能很強大也很是好用,下面總結一下安裝步驟和相應的配置。html
下載地址:https://www.iterm2.com/downlo...git
也能夠經過Homebrew來安裝github
$ brew cask install iterm2
iTerm2 最經常使用的主題是 Solarized Dark themevim
下載地址:http://ethanschoonover.com/so...curl
下載的是壓縮文件,解壓後,打開iTerm2,按Command+,
鍵,打開Preferences配置頁面,而後Profiles -> Colors -> Color字體
Presets -> Import,選擇剛解壓的壓縮文件solarized->iterm2-colors-solarized->Solarized Dark.itermcolors
文件,導url
入成功,最後選擇Solarized Dark 主題,就能夠了。spa
Oh My Zsh 是對主題的進一步擴展,地址:https://github.com/robbyrusse...插件
一鍵安裝:命令行
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
安裝好以後,須要把 Zsh 設置爲當前用戶的默認 Shell(這樣新建標籤的時候纔會使用 Zsh):
$ chsh -s /bin/zsh
而後,咱們編輯vim ~/.zshrc
文件,將主題配置修改成ZSH_THEME="agnoster"
agnoster
是比較經常使用的 zsh 主題之一,你能夠挑選你喜歡的主題,zsh 主題列表:https://github.com/robbyrusse...
配置後,效果以下:
使用上面的主題,須要 Meslo 字體支持,要否則會出現亂碼的狀況,字體下載地址:Meslo LG M Regular for Powerline.ttf
下載好以後,直接在 Mac OS 中安裝便可。
而後打開 iTerm2,按Command + ,
鍵,打開 Preferences 配置界面,而後Profiles -> Text -> Font -> Chanage Font
,選擇
Meslo LG M Regular for Powerline
字體
這個功能很是的實用,能夠提升咱們的開發效率
先克隆zsh-autosuggestions
項目,到指定目錄:
$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
而後編輯vim ~/.zshrc
文件,找到plugins
配置,增長zsh-autosuggestions
插件。
命令 | 說明 |
---|---|
command + t | 新建標籤 |
command + w | 關閉標籤 |
command + 數字 command + 左右方向鍵 | 切換標籤 |
command + enter | 切換全屏 |
command + f | 查找 |
command + d | 垂直分屏 |
command + shift + d | 水平分屏 |
command + option + 方向鍵 command + [ 或 command + ] | 切換屏幕 |
command + ; | 查看歷史命令 |
command + shift + h | 查看剪貼板歷史 |
ctrl + u | 清除當前行 |
ctrl + l | 清屏 |
ctrl + a | 到行首 |
ctrl + e | 到行尾 |
ctrl + f/b | 前進後退 |
ctrl + p | 上一條命令 |
ctrl + r | 搜索命令歷史 |