写到这一篇才算是写到了真正重要的东西。
我们要用的终端配置是 iTerm2 + oh-my-zsh + solarized 配色
首先去iterm2官网下载 iterm2
打开偏好设置
关闭 Closing 里面的两个提示选项和Selection中的Copy to pasteboard on selection
Advanced->Add status bar icon when exclude from dock?改为 yes
Appearance 勾选 stretch tabs to full bar System->Exclude from Dock and Application Switcher
Profile 下 Colors->color presets 选择Solarized Dark text 下 Cursor 选择 Vertical Bar 取消勾选Draw bold text in bright colors Window下Style 选择 Top of Screen,勾选Hide after Opening
Terminal 下 选择 Unlimited Scrolback、Slience bell 取消Show bell icon in tabs
keys 下开启全局快捷键
安装oh-my-zsh
使用下面的命令安装
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
安装 Powerline 字体
按照官网教程,使用以下命令安装
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
用vim打开隐藏文件 .zshrc ,修改主题为 agnoster:
ZSH_THEME="agnoster"
安装 zsh 插件
自动提示命令zsh-autosuggestions
- 克隆代码仓库
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
- 在 zsh 中启用 zsh-autosuggestions
找到
plugins=(
git
)
修改为
plugins=(
zsh-autosuggestions
git
)
- 重新打开 iterm2
当你重新打开终端的时候可能看不到变化,可能你的字体颜色太淡了,我们把其改亮一些:
移动到 ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions 路径下cd ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
用
vim
打开zsh-autosuggestions.zsh
文件,修改ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
语法高亮
-
使用homebrew安装 zsh-syntax-highlighting 插件。
brew install zsh-syntax-highlighting
-
配置.zshrc文件,插入一行。
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
-
使用配置生效。
source ~/.zshrc
homebrew 的安装见下一篇文章
最后,贴一下我在 zshrc 文件中用到的别名
alias vi='vim'
alias vim='mvim'
alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"
alias nano="subl"
alias em='emacs'
alias emacs='/usr/local/bin/emacs'
alias chrome='open -a Google\ Chrome'
alias ch=chrome
alias qq='open -a QQ'
alias wx='open -a WeChat'
alias finder='open -a finder'
alias f='finder'
alias sd='sudo'