2.Mac篇 - iterm2 - 開發環境搭建

weixin_33670713發表於2017-03-26

參考:

  1. Mac開發大雜燴
  2. Mac 下配置終端環境 iTerm2 + Zsh + Oh My Zsh + tmux | 明無夢
  3. oh-my-zsh 官網

配置

  1. 工具:
  • tig:

    • 說明:
      文字瀏覽器方式檢視git的提交

    • 快捷鍵:
      tig:顯示提交
      q:退出
      / + ...:查詢(與vim一致)
      enter:檢視具體提交內容
      上下箭頭:移動檢視提交

    • 參考:

      1. Tig: text-mode interface for Git
      2. tig - git地址
  • ccat

    • 說明:
      程式碼高亮顯示cat
    • 改變快捷鍵:
      alias cat=ccat # 這樣可以直接使用cat
  1. iterm2:

    1. 開啟配置項
      Command + ,
    2. 建立一個配置賬戶
      Profiles -> + -> Name(General部分)
    3. 配置每次開啟都是當前目錄,而非根目錄
      Profiles(自己的賬戶) -> Reuse previous session's directory (Working Directory under Generals)
    4. 主題 - dracula:
  2. zsh:

    1. 參考:

      1. ohmyzsh - 官網
      2. [git 地址](https://github.com/robbyrussell/oh-my-zsh
    2. 安裝:

      # curl 安裝方式:
      sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
      # wget 安裝方式:
      sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
      
    3. 錯誤:

      1. .zshrc:3: command not found: ^M
        .oh-my-zsh/oh-my-zsh.sh:42: parse error near `||'
        https://github.com/robbyrussell/oh-my-zsh/issues/4870
        關鍵程式碼:
        cd $ZSH
        git config core.autocrlf input
        git rm --cached -r .
        git reset --hard
        
    4. 主題:

      1. cloud
        .zshrc裡配置
    5. 外掛:

      1. zsh-autosuggestions:
    6. 使用bashmarks.sh(快捷跳轉)

      1. 在配置檔案~/.zshrc裡最後新增如下命令:
      # bashmarks.sh
      unalias g      # 取消g的別名(zsh預設為git)
      source /Users/mingwang/Opt/bashmarks.sh
      
    7. 設定word_separators

      1. 開啟設定:command + ,
      2. 在word for selection部分:
        /-+\~_.$
        

其他配置:

  1. iterm2開啟之前開啟的位置
  2. 主題配置
    • 參考:
      1. iterm2 - 主題Dracula
    • 設定:
      1. 主題網站下載對應的主題
      2. Perferences -> Profiles -> Colors(選擇對應的Profile Name)-> Color Presets -> Import
      3. Perferences -> Profiles -> Colors(選擇對應的Profile Name)-> Color Presets -> 選擇指定的主題
    • 說明:
      1. 推薦主題:
        Dracula
  3. 外掛

相關文章