基本市面上的軟件都能經過 brew install softwareName
的方式進行安裝。例如: git、google-chrmoe...node
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
複製代碼
固然仍是經過 brew
進行安裝 ITerm2
git
# ITerm2
$ brew install caskroom/cask/iterm2
複製代碼
都安裝好後,咱們就來配置下終端命令行工具,讓它變的超酷起來。github
1. iTerm2 -> Make iTerm2 Default Termnpm
2. 打開偏好設置preference,選中Keys,勾選Hotkey下的Show/hide iTerm2 with a system-wide hotkey,將熱鍵設置爲 ⌘+. ,這樣你就能夠經過 ⌘+. 全局熱鍵來打開或關閉iTerm2窗口,很是方便vim
3. 配色方案,選用 solarized,下載解壓,而後打開 iTerm2 下的偏好設置 preference ,點開 profiles 下的colors 選項,點擊右下角的 Color Presets 選項,選擇import ,導入解壓到的 solarized 文件下的Solarized Dark.itermcolorsruby
4. 安裝 oh-my-zshbash
# oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
複製代碼
5. 配置主題curl
一、 用 vim 編輯隱藏文件 .zshrc, 終端輸入vi ~/.zshrc ZSH_THEME="agnoster" 將zsh主題修改成「agnoster」 二、 應用「agnoster」主題須要特殊的字體支持,不然會出現亂碼狀況, 使用 Meslo 字體,點開連接點擊 view raw 下載字體 三、 安裝字體到系統字體冊 四、 在iTerm2中應用字體 iTerm -> Preferences -> Profiles -> Text -> Change Font) 五、 從新打開iTerm2窗口(或新打開一個iTerm2窗口)便可以看到字體效果 ide
推薦powerlevel9k 主題工具
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
複製代碼
而後編輯你的~/.zshrc,設置主題ZSH_THEME="powerlevel9k/powerlevel9k"
6. 自動提示與命令補全
一、克隆倉庫到本地 ~/.oh-my-zsh/custom/plugins 路徑下
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
複製代碼
二、用 vim 編輯 .zshrc 文件,找到插件設置命令,默認是 plugins=(git) ,咱們把它修改成plugins=(zsh-autosuggestions git)
PS:當你從新打開終端時可能看不到變化,可能你的字體顏色太淡了,咱們把其改亮一些:
cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
vim
編輯 zsh-autosuggestions.zsh
文件,修改ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
7. 語法高亮效果
$ brew install zsh-syntax-highlighting
複製代碼
在.zshrc
文件的末尾添加下面這一段:
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
複製代碼
而後,加載.zshrc配置
$ source ~/.zshrc
複製代碼
powerlevel9k 主題
, 因此個人首行提示是這樣修改的, 在 .zshrc
文件末尾增長下面一行:# Powerlevel9k Theme config
POWERLEVEL9K_CONTEXT_TEMPLATE="%n"
複製代碼
或者,全部主題都適用的方式,仍是在.zshrc
文件裏進行配置:
ZSH_THEME="powerlevel9k/powerlevel9k"
# 隱藏用戶名稱(user@hostname)
DEFAULT_USER=`id -un`
# 含有icon的字型,前提你的字體有icon
POWERLEVEL9K_MODE='nerdfont-complete'
# command line 左邊提示內容(文件夾路徑、文件夾讀寫狀態、版本控制資訊)
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir dir_writable vcs) # <= left prompt 設了 "dir"
# command line 右邊提示內容(狀態、時間)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)
複製代碼
最後顯示成果:
字體:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
複製代碼
若是重啓終端後發現,nvm
未找到此命令, 將下面的源代碼行添加到您的配置文件(〜/ .bash_profile
,〜/ .zshrc
,〜/ .profile
或〜/ .bashrc
)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
複製代碼
安裝Node
# install
$ nvm install 8
# use
$ nvm use default
$ node -v
$ npm -v
複製代碼
# 全局安裝
$ npm install -g nrm
# 查看當前 npm 源列表
$ nrm ls
# 選擇 taobao 源
$ nrm use taobao
# 查看 npm 源是否更改
$ npm config get
複製代碼