iTerm2 + zsh

Install iTerm2

1
brew cask install iterm2

or Download and install iTerm2

  • Set solarized-dark color
1
2
Preferences > Profiles > Colors:
Color Presets > Solarized Dark

Install powerline/fonts

powerline/fonts: Patched fonts for Powerline users. Here we install it to support agnoster.zsh-theme.

powerline/fonts git repo

  • Install by git-clone and run install.sh
1
2
3
4
5
6
7
8
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit (optional)
cd ..
rm -rf fonts

iTerm2 preference configuration

This is an image in `static/image` folder.

To test if your terminal and font support agnoster.zsh-theme, check that all the necessary characters are supported by copying the following command to your terminal:

1
echo "\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699"

Install zsh

oh-my-zsh is a framework for managing your zsh configuration.

Includes 200+ optional plugins, over 140 themes to spice up your morning, and an auto-update tool.

via curl

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

via wget

1
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

For non-sudoer, only change a specific user

1
2
export SHELL=/usr/bin/zsh
exec /usr/bin/zsh --login

zsh conf: .zshrc

  • Update zsh theme in .zshrc
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"

# ...

plugins=(
  git
)

# ...

# optionally set DEFAULT_USER in ~/.zshrc to your regular username to hide the “user@hostname” info when you’re logged in as yourself on your local machine.
# DEFAULT_USER=$(whoami)
DEFAULT_USER=xqzhang
  • zsh folder structure
1
2
3
4
5
ls ~/.oh-my-zsh/
CONTRIBUTING.md LICENSE.txt     README.md       cache           custom          lib             log             oh-my-zsh.sh    plugins         templates       themes          tools

ls ~/.oh-my-zsh/themes/
agnoster.zsh-theme robbyrussell.zsh-theme ...

Zsh custom plugins

zsh-autosuggestions

Fish-like autosuggestions for zsh. It suggests commands as you type, based on command history.

  1. Clone this repository into $ZSH_CUSTOM/plugins (by default .oh-my-zsh/custom/plugins)
1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  1. Add the plugin to the list of plugins for Oh My Zsh to load (inside .zshrc):
1
2
3
plugins=(
  zsh-autosuggestions
)
  1. Start a new terminal session.

Other plugins