参考链接:https://gist.github.com/kevin-smets/8568070
- install iTerm2
brew cask install iterm2
- Install oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
When the installation is done, edit ~/.zshrc and set ZSH_THEME="agnoster"
- install Powerlevel9k
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
Then edit your ~/.zshrc and set ZSH_THEME="powerlevel9k/powerlevel9k".
- Install a patched font
SourceCodePro+Powerline+Awesome+Regular has better alignment for the glyphs @14px.
Click "view raw" to download the font.Open the downloaded font and click "Install Font".
-
Set this font in iTerm2 (14px is my personal preference) (iTerm → Preferences → Profiles → Text → Change Font).
如下图:
Restart iTerm2 for all changes to take effect.
不确定:是否还要安装这个,看readme.md 照做:https://github.com/powerline/fonts
- install fontawsome patched fonts
看README.md: https://github.com/gabrielelana/awesome-terminal-fonts/
~$: mkdir .fonts // 在user根目录创建一个隐藏目录 .fonts
~$: cp *.sh ~/.fonts
将`source ~/.fonts/*.sh` 放到 ~/.bashrc or ~/.zshrc
~$: source ~/.zshrc
- install theme
git clone https://github.com/MartinSeeler/iterm2-material-design/blob/master/material-design-colors.itermcolors
- Type CMD+i
- Navigate to Colors tab
- Click on Color Presets
- Click on Import
-
Choose a color scheme: Select the .itermcolors file(s) of the material-design-colors.itermcolors scheme(s)
在当前的 Preferences ---> gerneral , 点击右下角:'Click to Set', 然后 关闭terminal 才会一直对该主题生效:
- 添加配置:
ZSH_THEME="powerlevel9k/powerlevel9k"
source $ZSH/oh-my-zsh.sh
source ~/.fonts/*.sh
POWERLEVEL9K_MODE='awesome-patched'
# Disable dir/git icons
POWERLEVEL9K_HOME_ICON=''
POWERLEVEL9K_HOME_SUB_ICON=''
POWERLEVEL9K_FOLDER_ICON=''
DISABLE_AUTO_TITLE="true"
POWERLEVEL9K_VCS_GIT_ICON='\uE1AA'
POWERLEVEL9K_VCS_STAGED_ICON='\u00b1'
POWERLEVEL9K_VCS_UNTRACKED_ICON='\u25CF'
POWERLEVEL9K_VCS_UNSTAGED_ICON='\u00b1'
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='\u2193'
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='\u2191'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
#POWERLEVEL9K_VCS_UNTRACKED_ICON='?'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon status dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(time)
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=4
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M \uE868 %d.%m.%y}"
POWERLEVEL9K_STATUS_VERBOSE=false
export DEFAULT_USER="$USER"
source $ZSH/oh-my-zsh.sh
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# 这里需要注意的是,这里是powerlevel9k 安装的路径
#由于我的安装:git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
#所以我的powerlevel9k 安装的路径是:~/.oh-my-zsh/custom/themes/powerlevel9k
source /Users/m*q/.oh-my-zsh/custom/themes/powerlevel9k
- install others
brew install zsh-completions
brew install zsh-autosuggestions
brew install zsh-syntax-highlighting
最终的效果如图所示:
- 敲命令时,会提示该命令是否正确
正确:绿色
不正确:红色
优化Vim
执行: git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim