前端知识前端web前端javascript

iTerm2 + oh my zsh + solarized +

2016-07-22  本文已影响1068人  荞叶

翻译一篇iTerm2+OMZ等配置的文章

687474703a2f2f6f6936332e74696e797069632e636f6d2f6970637561782e6a7067.png

如何安装

iTerm2

�选择以下主题配置方案

Screen Shot 2016-07-22 at 20.22.15.png

下载并安装主题包, 这些主题会被安装到iTerm2。iTerm -> preferences -> profiles -> colors -> load presets。

Oh my zsh

关于OMZ想了解更多,请访问: https://github.com/robbyrussell/oh-my-zsh

用curl安装OMZ

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

安装完成,编辑 ~/.zshrc 设置 ZSH_THEME="agnoster"

安装主题需要的字体文件补丁

在iTerm中应用字体 (我自己设置14px字体大小) (iTerm -> Preferences -> Profiles -> Text -> Change Font).

重启 iTerm2后,修改的配置会生效

进一步优化iTerm2

以下:

自动建议 (oh-my-zsh)

自动建议

根据以下步骤安装: https://github.com/tarruda/zsh-autosuggestions#oh-my-zsh

Screen Shot 2016-07-22 at 20.38.03.png

如果自动建议没有生效, 那么极有可能是因为主题配置的问题。"iTerm -> Preferences ->Profiles-> Colors tab",检查Black Bright, 自动建议框的背景颜色和这个一样。所以我把Solarized Dark Black Bright 设置为 "586e75".

设置光标移动一个单词

默认情况下,光标移动一个单词 (option + → or ←) 是不生效的. "iTerm -> Preferences -> Profiles -> Keys". 点击+ 注册以下快捷键

Option + right

⌥→
Send Escape Sequence
f

Option + left

⌥←
Send Escape Sequence
b

iTerm前缀减短模式

Screen Shot 2016-07-22 at 20.45.10.png Screen Shot 2016-07-22 at 20.54.11.png

默认情况下,iTerm会像上图一样显示“user@hostname” . 这样会让你的命令过长。在 ~/.zshrc里,设置 DEFAULT_USER成你的用户名,用户名为 “user@hostname” 的hostname.比如如上图,那么设置“DEFAULT_USER=sam”. 设置成功后,你可以用命令whoami来检查自己用户名

声名高亮

brew install zsh-syntax-highlighting

如果你不喜欢用homebrew安装, 按以下说明步骤安装吧 安装说明.

安装完成后

source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

加到.zshrc 的末尾,然后重启iTerm生效。

上一篇 下一篇

猜你喜欢

热点阅读