Post

How to migrate to iterm2 with customisations?

I have been using the default Terminal application in Mac OSX from a while and was always skeptical about moving to iterm2, until I recently experienced it.

Current configuration

A pretty decent terminal with

and it looks like:

default mac osx terminal

iTerm2

iTerm2 has various features, my favorite is split panes. You can actually split the panes in two parts vertically, one with vim and another with terminal(geeky!!).

Installation

To install iterm2 using brew:

1
brew install iterm2

Post successful installation, go to launcher and open iTerm

iterm2

We see that it has taken current zshrc configruations.

Using Agnoster Theme

Try switching themes? Another popular theme is Agnoster

  • Step 1: Install prerequisite: Powerline Fonts:
    1
    2
    3
    
      git clone https://github.com/powerline/fonts.git
      cd fonts
      ./install.sh
    
  • Step 2: Edit ~/.zshrc and set theme as agnoster:

    zshrc oh-my-zsh theme robbyrussell

    to

    zshrc oh-my-zsh theme agnoster

    Ah, seems broken?

    zshrc oh-my-zsh theme broken

  • Step 3: Use Meslo font in terminal settings:

    iTerm2 > Settings > Profiles > Text > Change font

    Set: “Meslo LG DZ for Powerline” iterm2 settings font

Yay!! Agnoster is ready! Have a look :)

iterm2 oh-my-zsh theme agnoster ready

Using Powerlevel10k Theme

I personally, like robbyrussell or powerlevel10k. Installation steps for powerlevel10k:

  • Step 1: Clone and install
    1
    
      git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
    
  • Step 2: Set theme in ~/.zshrc
    1
    
      ZSH_THEME="powerlevel10k/powerlevel10k"
    
  • Step 3: Exit terminal and open again or source ~/.zshrc to configure powerlevel10k

    • 3a: type y to install Meslo Nerd Font iterm2 oh-my-zsh theme powerlevel10k configuration font

      Once, installed it will ask you to quit and open iTerm to continue.

    • 3b: type y if you see the correct diamond iterm2 oh-my-zsh theme powerlevel10k configuration diamond

    • 3c: type y if you see the correct lock iterm2 oh-my-zsh theme powerlevel10k configuration lock

    • 3d: type y if you see the correct arrow iterm2 oh-my-zsh theme powerlevel10k configuration arrow

    • 3e: type y if you see icons fit between crosses iterm2 oh-my-zsh theme powerlevel10k configuration icons

    • 3f: select prompt style as you like, I’m selecting 3 iterm2 oh-my-zsh theme powerlevel10k configuration prompt

    • 3g: select character set as unicode 1 iterm2 oh-my-zsh theme powerlevel10k configuration character set

    • 3h: set your preference for time, I don’t need it so n iterm2 oh-my-zsh theme powerlevel10k configuration time

    • 3i: set your preference for prompt separator, 1 iterm2 oh-my-zsh theme powerlevel10k configuration prompt separator

    • 3j: set your preference for prompt heads, 1 iterm2 oh-my-zsh theme powerlevel10k configuration prompt heads

    • 3k: set your preference for prompt tails, 1 iterm2 oh-my-zsh theme powerlevel10k configuration prompt tails

    • 3l: set your preference for prompt height, 1 iterm2 oh-my-zsh theme powerlevel10k configuration prompt height

    • 3m: set your preference for prompt spacing, 2 iterm2 oh-my-zsh theme powerlevel10k configuration prompt spacing

    • 3n: set your preference for icons, 2 iterm2 oh-my-zsh theme powerlevel10k configuration icons

    • 3o: set your preference for prompt flow, 1 iterm2 oh-my-zsh theme powerlevel10k configuration prompt flow

    • 3p: would you like to enable prompt transient, n iterm2 oh-my-zsh theme powerlevel10k configuration prompt transient

    • 3q: would you like to enable prompt transient, n iterm2 oh-my-zsh theme powerlevel10k configuration prompt transient

    • 3r: enable prompt mode as verbose, 1 iterm2 oh-my-zsh theme powerlevel10k configuration verbose prompt

    • 3s: apply changes to zshrc, 3 iterm2 oh-my-zsh theme powerlevel10k configuration apply

And all set!

iterm2 final

VSCode font settings

Oh snap! I just realised that the VSCode Terminal does not display any icons in prompt. To fix this, go to VSCode settings or settings.json and add following:

1
"terminal.integrated.fontFamily": "MesloLGS NF",

This worked for me :)

Split panes in action

iterm2 split panes

Happy bashing!

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.