1. iterm2
下載 iTerm 軟件 :
http://iterm2.com/
直接下載安裝即可;
2. 安裝oh my zsh
打開Iterm2輸入
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
3. 安裝powerline字體
git clone https://github.com/powerline/fonts.git
進入fonts目錄
cd fonts
./install.sh
刪除fonts目錄
cd ..
rm -rf fonts
3. iTerm2 配置使用
打開左上標簽
iTerm2 / Preference / Profiles / Text - font
選擇 change font , 可以修改字體和字體大小;找到一 Powerline 結尾的字體就可以;
Screen Shot 2017-11-12 at 12.39.37 PM.png
4.下載并安裝solarized,設置vim環境
git clone git://github.com/altercation/solarized.git
vim配置:
cd solarized/vim-colors-solarized/colors
cp solarized.vim ~/.vim/colors/
提示:~/.vim/colors/文件夾需要自己創建
5.啟動Solarized主題,Terminal需要重啟生效
vi ~/.vimrc
修改.vimrc添加配置文件
syntax enable
set background=dark
colorscheme solarized
set rtp+=/Users/zhouhan/powerline/powerline/bindings/vim
set guifont=Monaco\ for\ Powerline:h14.5
set laststatus=2
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
set number
set fillchars+=stl:\ ,stlnc:\
set term=xterm-256color
set termencoding=utf-8
6.安裝coreutils(使文件夾和文件顯示為彩色)
brew install xz coreutils
生成顏色定義文件
gdircolors --print-database > ~/.dir_colors
在~/.zshrc配置文件中加入以下代碼
if brew list | grep coreutils > /dev/null ; then
PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
alias ls='ls -F --show-control-chars --color=auto'
eval `gdircolors -b $HOME/.dir_colors`
fi
gdircolor的作用就是設置ls命令使用的環境變量LS_COLORS(BSD是LSCOLORS),
我們可以修改~/.dir_colors自定義文件的顏色,此文件中的注釋已經包含各種顏色
取值的說明。
看看默認顏色的顯示效果。
7.下載并設置zsh-syntax-highlighting插件(命令錯誤檢查)
cd ~/.oh-my-zsh/custom/plugins
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
plugins=(zsh-syntax-highlighting)
8.一些小命令
查看本機所有shell
cat /etc/shells
查看當前使用的 Zsh 版本
echo $ZSH_VERSION