Browsed by
Month: August 2016

Installing ZSH and Oh-My-Zsh with my favorite theme: agnoster!

Installing ZSH and Oh-My-Zsh with my favorite theme: agnoster!

Hi guys,

In this small post I’m showing you how to install the ZSH shell interpreter and one of my favorite themes Agnoster. Firstly, the terminal of choice for this article (and also my personal choice) is Terminator. You can find it in any repository for most distributions.

In Ubuntu, these simple commands install Terminator:

sudo apt-get install -y terminator

Next, to install ZSH run the following command:

sudo apt-get install -y zsh

Once installed, the default terminal is automatically changed to zsh. If this is not the case, use the following commands to set it as default:

#first check the location
which zsh
/bin/zsh

#now change shell from /bin/bash to /bin/zsh
chsh
Password: 
Changing the login shell for root
Enter the new value, or press ENTER for the default
	Login Shell [/bin/bash]: /bin/zsh

Now if you restart your terminator instance it should open using ZSH! It’s now time to install Oh-My-Zsh.

Oh-My-Zsh is a github project framwork for managing your Zsh configuration. It includes 180+ optional plugins and more than 120 themes to spice up your journey. For complete information, please visit the official Git home page : robbyrussell – oh-my-zsh.

To install Oh-My-Zsh run the following command:

wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh

As I’ve mentioned, my favourite theme is “agnoster”. You can check out other themes at this URL.

To set up Oh-My-Zsh to use the agnoster theme just edit the ~/.zshrc configuration file (unique for each user) and add the name of the theme to the ZSH_THEME variable:

ZSH_THEME="agnoster"

Once changed the theme, specific Fonts have to be installed in order to fully support it:

#clone repo
git clone https://github.com/powerline/fonts.git
cd fonts
#start install script
sudo ./install.sh

And now, open Terminator and go under the Preference menu (right-click -> Preferences). Under Profiles you should find the General tab with the possibility to change the font. Replicate the one set up in the image here below:
terminalFont

The last step is to set up the syntax highlighting plugin:

#move to zsh plugin folder
cd ~/.oh-my-zsh/plugins
#clone repo
git clone https://github.com/zsh-users/zsh-syntax-highlighting
# enable plugin in zshrc
nano ~/.zshrc
#find the plugin and add syntax
+plugins=(git zsh-syntax-highlighting)

#source modif
source .zshrc

And there you go. End result should look something like this:

final_zsh

Enjoy!