作为一个整天跟日志和数据库打交道的程序员,动手稍微设置一下自己的终端将其改造为一个顺手好用的工具是一个态度问题.
iterm2
安装
iterm2 这个不用多说,贼好用,比自带的终端更强大
配置
将iTem2设置为默认终端:
// 设置默认终端
iTerm2 -> Make iTerm2 Default Term
// 设置全局 唤起/最小化 热键
偏好设置->keys->Hotkey->Show/hide iTerm2 with a system-wide hotkey
配色方案
solarized效果还不错。 http://ethanschoonover.com/solarized 下载解压
偏好设置->profiles->colors->Color Presets->import->导入解压出来的Solarized Dark.itermcolors。
安装oh-my-zsh
github:https://github.com/robbyrussell/oh-my-zsh
// curl
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
// wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
主题
安装成功后,用vim打开隐藏文件 .zshrc ,修改主题为 agnoster:
主题效果可在: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 查看
ZSH_THEME=”agnoster” 默认为该主题
应用这个主题需要特殊的字体支持,否则会出现乱码情况,这时我们来配置字体:
1.使用 Meslo 字体,点开连接点击 view raw 下载字体。
2.安装字体到系统字体册。
3.应用字体到iTerm2下,我自己喜欢将字号设置为14px,看着舒服(iTerm -> Preferences -> Profiles -> Text -> Change Font)。
4.重新打开iTerm2窗口,这时便可以看到效果了。
自动提示命令
克隆仓库到本地 ~/.oh-my-zsh/custom/plugins 路径下
cd ~/.oh-my-zsh/custom/plugins
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
# 修改 .zshrc
vi ~/.zshrc
// plugins=(zsh-autosuggestions git)
语法高亮
brew install zsh-syntax-highlighting
// 配置.zshrc文件,插入一行
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
// 输出命令
source ~/.zshrc
tmux 复用会话插件
brew install tmux