DEV Community

Saoud
Saoud

Posted on

Customize iTerm

First of all, install iTerm2 (because it provides a much better experience with Oh My Zsh and Powerlevel10k); either download it and install it from here iTerm or use “homebrew”:

brew install --cask iterm2
Enter fullscreen mode Exit fullscreen mode

Then, install Oh My Zsh; since I have “curl” installed, I’m using this command (otherwise, see the Oh My Zsh URL for alternative options):

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Enter fullscreen mode Exit fullscreen mode

Then, we install p10k:

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Enter fullscreen mode Exit fullscreen mode

To enable it, edit “~/.zshrc” and set the variable ZSH_THEME accordingly:

ZSH_THEME="powerlevel10k/powerlevel10k"
Enter fullscreen mode Exit fullscreen mode

Now, either “source” the .zshrc file or open a new instance of iterm2 to see the initial configuration of p10k (remember you can always reconfigure it by running “p10k configure”):

Meslo fonts are recommended to have nice icon fonts, so it’s best to accept the proposal to install the Meslo fonts (in macOS, you have this nice automatic procedure). Let’s wait for the fonts to be downloaded.

Then restart iTerm2 or open a new tab.

Now, we start a new iterm2 instance, and we start p10k from scratch, it will prompt you with questions for checking whether we can see the font icons correctly.

Then, we can start choosing our preferred options, pick whichever ones you prefer and look best to you.

Now, I install two other useful plugins (to have syntax highlighting on the command line and to have suggested commands as you type based on history and completions):

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Enter fullscreen mode Exit fullscreen mode

The plug-ins must be enabled in the proper section of ~/.zshrc:

plugins=( ... exsiting plugins...
zsh-syntax-highlighting
zsh-autosuggestions
)
Enter fullscreen mode Exit fullscreen mode

I also like to have fzf, a general-purpose command-line fuzzy finder. This must be first installed as a program, e.g., with homebrew:

brew install fzf
Enter fullscreen mode Exit fullscreen mode

I like to add a few more plugins and then enable the corresponding plug-in which include fzf:

plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
  zsh-interactive-cd
  zsh-navigation-tools
  fzf
) 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)