Oh-My-Zsh Installation

 

This is a guide to install Oh My Zsh

Install Prereqs: Zsh & Git

First we need to install Zsh. This will be the basis of Oh-My-Zsh.

sudo apt install zsh

Next, we need to install git

sudo apt install git

Now we need to get the installation script and then install it

wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh
bash ./install.sh

In the installation, it will ask if you wish to change your default shell to zsh. Say yes, enter your username password, and you’ll receive a screen like the one below. If you miss it, run the command below, followed by logging out and back in to make the change Source

chsh -s $(which zsh)

Now you can start editing your ~/.zshrc file.

Customize Oh-My-Zsh

Choosing a theme.

There are multiple themes that you can use. I like agnoster and powerlevel9k. In order to change the theme, in your ~/.zshrc, you need to change the ZSH_THEME variable

ZSH_THEME="agnoster"

But if you simply source it, you will get some errors

Fixing the Fonts

In order to fix those issues, you need to

$ git clone https://github.com/powerline/fonts.git
$ cd fonts
$ ./install.sh

Next go to your terminal’s Preferences and change it to the Font: Meslo LG S DZ for Powerline Regular or whichever Powerline font you prefer.

Plugins

This will automatically come with the git plugin, which is defined in your ~/.zshrc file

plugins=(git)

Using Powerlevel9K Shell

Install the PowerLevel9K Shell

In order to have install the Powerlevel9K theme, you need to clone it into your themes folder

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

Set your theme to ZSH_THEME="powerlevel9k/powerlevel9k in your ~/.zshrc file, and source it.

Install Nerd Fonts

There are many fonts that you can use with PowerLevel9K. Nerd Fonts have a lot of icons that can be use. Hack

You can follow their instructions to install their fonts, and add the following in the ~/.zshrc file

POWERLEVEL9K_MODEL="nerdfont-complete"

Customize the PowerLevel9K Prompt

There are a lot of different customizations that you may use

https://github.com/Powerlevel9k/powerlevel9k/wiki/stylizing-your-prompt

This is one setting that I like.

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon virtualenv anaconda context dir vcs status)

In the end, you’ll get something like this

Additional Settings

Below are a number of different settings:

POWERLEVEL9K_OS_ICON_BACKGROUND=024 #navyblue
POWERLEVEL9K_OS_ICON_FOREGROUND=202 #orangered1
POWERLEVEL9K_CONTEXT_TEMPLATE='%n'
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=249 # white
POWERLEVEL9K_DIR_HOME_FOREGROUND=249
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND=249
POWERLEVEL9K_DIR_ETC_FOREGROUND=249
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND=249
POWERLEVEL9K_DIR_HOME_BACKGROUND=024 #deepskyblue4a
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND=024 #deepskyblue4a
POWERLEVEL9K_DIR_ETC_BACKGROUND=024 #deepskyblue4a
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND=024 #deepskyblue4a
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_STATUS_CROSS=true
POWERLEVEL9K_STATUS_OK_BACKGROUND=017
POWERLEVEL9K_STATUS_ERROR_BACKGROUND=017

POWERLEVEL9K_VCS_CLEAN_FOREGROUND=017 # navyblue
POWERLEVEL9K_VCS_CLEAN_BACKGROUND=040 # green3a
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND=017 # navyblue
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND=220 # gold1
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND=236 #grey19
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND=160 #red3a
POWERLEVEL9K_SHOW_CHANGESET=true

Other Separators

You can also use different separators

https://github.com/ryanoasis/powerline-extra-symbols

Additional

If you are using Snap packages, because you are now using zsh, they won’t get recognized as applications for your environment. In order to be able to recognize or to allow them to be added, e.g. to your Latte Dock (if using KDE), as per hackel’s suggestion, you need to add the following line to your /etc/zsh/zprofile

emulate sh -c 'source /etc/profile'

Now, just log out and log back in, and you’ll see the changes.