Mar 30, 2021

Oh My Zsh + PowerLevel10k = 😎 terminal

Avatar of abdfnx Abdfn

Hi there, The developers always use the terminal, but it is boring and has no colors or shapes. Today we will transform our terminals into a wonderful, colorful, supportive terminal that offers suggestions and more, we’ll do it by OMZ and design it by PowerLevel10k

Pre-requisites

if you’re using Windows, you can install and configure WSL

and I recommended to use Ubuntu or Debian wsl plugin

Setup zsh

in the command line type

# Homebrew
brew install zsh

# APT
sudo apt install zsh
zsh

Install Oh My Zsh

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

PowerLevel10k

  • Install Powerlevel10k using the following command
# Github CLI
gh repo clone romkatv/powerlevel10k $ZSH_CUSTOM/themes/powerlevel10k

# Git
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Then you need to enable it, change the value of ZSH_THEME to following in ~/.zshrc file :

ZSH_THEME="powerlevel10k/powerlevel10k"

Cheat-sheet for Windows

if you’ve Windows terminal you can open your settings and in UNIX preferences and add fontFace prop, assign it to FiraCode NF.

{
  "guid": "{YOUR_UNIX_GUID}",
  "hidden": false,
  "name": "Ubuntu",
  "source": "Windows.Terminal.Wsl",
  "fontFace": "FiraCode NF",
  "snapOnInput": true,
  "useAcrylic": true
}

Windows Terminal url in Microsoft Store: url

Windows Terminal repo: url

p10k configure

  • Make sure your terminal font is FiraCode NF.

font link: url

for windows users: url

type

p10k configure

Powerlevel10k

you can choose your style…

Plugins (Optional, Good to have!)

Clone plugins

  • zsh-syntax-highlighting - It enables highlighting of commands whilst they are typed at a zsh prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.
# Github CLI
gh repo clone zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# Git
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  • zsh-autosuggestions - It suggests commands as you type based on history and completions.
# Github CLI
gh repo clone zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

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

ls tools

  • colorls: A Ruby script that colorizes the ls output with color and icons

  • exa: is a modern replacement for ls

# colorls
sudo gem install colorls

# exa
brew install exa

Activate the plugins

In ~/.zshrc file replace the line starting with plugins=() to below line.

plugins=( git zsh-syntax-highlighting zsh-autosuggestions )

Activate the List Tools

ColorLS

if [ -x "$(command -v colorls)" ]; then
  alias ls="colorls"
  alias la="colorls -al"
fi

Exa

if [ -x "$(command -v exa)" ]; then
  alias ls="exa"
  alias la="exa --long --all --group"
fi

Some more official plugins - ohmyzsh plugins

after all these steps type

source ~/.zshrc

Finally it should be like this 👇

Mac

Final Mac

Windows(WSL) or Linux

Final WSL

More articles

It's Secman V2 Time

New features, New design, New infrastructure, and New secman...

Avatar of abdfnx Avatar of timothee-cardoso Avatar of david-tomson Nov 15, 2021

Secman V2

The New Version of secman will use api.secman.dev

Avatar of abdfnx Avatar of timothee-cardoso Avatar of imrxm7md Avatar of david-tomson Sep 27, 2021

The Release Notes Moved to the Changelog Page

Secman Release Notes moved to changlog page

Avatar of imrxm7md Sep 26, 2021