Pimp My Shell

Jul 7, 2022·
Jeff Soczek
Jeff Soczek
· 3 min read

Kali is using Zsh as the default shell since release 2020.4, so everybody had more than enough time to overcome their grief. During the time I’ve been using it, I found out some tricks, so, here’s my version of zsh + oh-my-zsh + spaceship + plugins.

Ligature Fonts

First, I want to make sure I have some monospaced font with programming ligatures and I’ll be using FiraCode for that. You can use any other that suits your style.

ZSH

If you’re not using it already, check if it’s installed with:

zsh --version

And then change the default shell to zsh:

chsh -s /bin/zsh

Oh My Zsh

Oh My Zsh will not make you a 10x developer…but you may feel like one!

To install Oh My Zsh, use this command (you must have curl already installed):

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

Spaceship

Spaceship is a minimalistic, powerful and extremely customizable Zsh prompt. To have it installed, just clone the repo and symlink the theme:

git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt"

ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"

Now, edit your ~/.zshrc and change the variable ZSH_THEME to look like this:

ZSH_THEME="spaceship"

While still editing the ~/.zshrc file, change the prompt to something you want. In my case, I started using this config:

SPACESHIP_PROMPT_ORDER=(
  user          # Username section
  dir           # Current directory section
  host          # Hostname section
  git           # Git section (git_branch + git_status)
  hg            # Mercurial section (hg_branch  + hg_status)
  exec_time     # Execution time
  line_sep      # Line break
  vi_mode       # Vi-mode indicator
  jobs          # Background jobs indicator
  exit_code     # Exit code section
  char          # Prompt character
)
SPACESHIP_USER_SHOW=always
SPACESHIP_PROMPT_ADD_NEWLINE=false
SPACESHIP_CHAR_SYMBOL="‚ĚĮ"
SPACESHIP_CHAR_SUFFIX=" "

Plugins

To manage the installation of the plugins, install the zinit:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"

After this, edit your ~/.zshrc¬†once more, now add the desired plugins right below the ### End of ZInit's installer chunk. Here I’m using these:

zinit light zdharma-continuum/fast-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-history-substring-search
  • zdharma/fast-syntax-highlighting: Adds syntax highlighting when writing commands, which makes it easier to recognize commands that have been typed incorrectly;
  • zsh-users/zsh-autosuggestions: Suggest commands based on execution history as you type;
  • zsh-users/zsh-completions: Adds thousands of completions for common tools like Yarn, Homebrew, NVM, Node, etc, so you just need to press TAB to complete commands;
  • zsh-users/zsh-history-substring-search: This is a clean-room implementation of the¬†Fish shell’s history search feature, where you can type in any part of any command from history and then press chosen keys, such as the UP and DOWN arrows, to cycle through matches.

Done

Even if all these tweaks won’t make you a better computer user, they will certainly make you look like you know what you’re doing. Hope this helps you customize your terminals!