Skip to content

Instantly share code, notes, and snippets.

@BukhariH
Forked from kevin-smets/iterm2-solarized.md
Created June 5, 2016 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BukhariH/1a5eeea64d08d41f5bb136cf948acac6 to your computer and use it in GitHub Desktop.
Save BukhariH/1a5eeea64d08d41f5bb136cf948acac6 to your computer and use it in GitHub Desktop.
iTerm2 + oh my zsh + solarized + Meslo powerline font (OSX)

How to install

iTerm2

  • Download and install iTerm2 (it has better color fidelity than the built in Terminal).

Get the iTerm color settings

Just save it somewhere and open the file(s). The color settings will be imported into iTerm2. Apply them in iTerm through iTerm -> preferences -> profiles -> colors -> load presets. You can create a different profile, other than Default if you wish to do so.

Oh my zsh

More info here: https://github.com/robbyrussell/oh-my-zsh

Install with curl

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 a patched font

Open the downloaded font and press "Install Font".

Set this font in iTerm2 (14px is my personal preference) (iTerm -> preferences -> profiles -> text).

  • Regular Font -> "Change Font"
  • Non-ASCII Font -> "Change Font"

Restart iTerm2 for all changes to take effect.

Further tweaking

Things like

  • auto suggestions
  • word jumping with arrow keys
  • shorter prompt style
  • syntax highlighting

can be found in the section below.

Auto suggestions (for oh-my-zsh)

Auto suggestions

Just follow these steps: https://github.com/tarruda/zsh-autosuggestions#oh-my-zsh

Enable word jumps

By default, word jumps (option + → or ←) do not work. You can make this work by adding the following to your ~/.zshrc

bindkey -e
bindkey '^[[1;9C' forward-word
bindkey '^[[1;9D' backward-word

If that does not work, an alternative is to go to iTerm - preferences - Keys.

Under global shortcut keys, add the following keyboard shortcuts:

Option + right

⌥→
Send Escape Sequence
f

Option + left

⌥←
Send Escape Sequence
b

Shorter prompt style

By default, your prompt will now show “user@hostname” in the prompt. This will make your prompt rather bloated. Optionally set DEFAULT_USER in ~/.zshrc to your regular username (these must match) to hide the “user@hostname” info when you’re logged in as yourself on your local machine. You can check your username value by executing whoami in the terminal.

Syntax highlighting

brew install zsh-syntax-highlighting

If you do not have or do not like homebrew, follow the the installation instructions instead.

After installation through homebrew, add

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

to the end of your .zshrc file. After that, it's best to restart your terminal. Sourcing your ~/.zshrc does not seem to work well with this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment