Set up iTerm2
iTerm2 is a Terminal alternative for macOS.
Installation
Install iTerm2 via Homebrew:
$ brew install --cask iterm2
Install oh-my-zsh via
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Set up movement & delete shortcuts
iTerm does not feature shortcuts for moving word-by-word or to the end or beginning of a line.
Go to .
Add these new key mapping, for each selection Send Escape Sequence as Action:
Key Mapping
Action
Value
Does what?
Alt+Left
Send Escape Sequence
b
Jump one word to the left
Alt+Right
Send Escape Sequence
f
Jump one word to the right
Alt+Del<-
Send Hex Code
0x17
Delete left standing word
Alt+Del->
Send Escape Sequence
d
Delete right standing word
Cmd+Left
Send Hex Code
0x01
Move to beginning of the row
Cmd+Right
Send Hex Code
0x05
Move to end of the row
Cmd+Del<- *
Send Hex Code
0x18 0x7f
Delete current row
Cmd+Del->
Send Hex Code
0x0b
Delete everything after cursor
* need to add this to your ~/.zshrc or ~/.zprofile to make it work:
# iTerm2 support for 'Delete current row' keymap bindkey "^X\\x7f" backward-kill-line
A quicker solution, but which does not feature all above key mappings is to change the presets to Natural Text Editing.
Set custom color theme
There a lot of color themes to choose from.
Open the XML files for the respective theme and save it as *.itermcolors file.
In iTerm go to .
Select and select the *.itermcolors file.
Again chose Color Presets…, and select the imported theme. They are immediately applied to the current shell.
Set custom oh-my-zsh theme
There are a variety of themes available for iTerm (all compatible with oh-my-zsh).
In this guide, the powerlevel10k theme is used for demonstration.
Install the theme via homebrew:
$ brew install powerlevel10k
Add it to your
~/.zshrcfile to be launched for each new shell window:$ echo "source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme" >>~/.zshrc
Open a new shell window to start the setup wizard.
Confirm installing the new font, afterwards restart iTerm2.
The setup resumes. Follow the instructions and make your choices
Add custom plugins
Oh-my-zsh features a lot of optional plugins for various purposes. A list is available in the Plugins wiki page. The only plugin already pre-enabled is the git plugin.
To add a plugin, open the ~.zshrc file and add the plugin name to the plugins variable,
for example:
plugins=(git pyenv)
Other tweaks
Change cursor to blinking, vertical bar:
:
select Vertical bar
check Blinking cursor
Add command syntax highlighting:
Install zsh-syntax-highlighting:
$ brew install zsh-syntax-highlighting
Enable it by adding a source line to your
~/.zshrcfile:$ echo "source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc