Skip to content

Oh My Zsh

image

Oh-my-zsh is used to help efficiently manage and configure the ZSH shell. It comes packed with functions, themes, and plugins to improve the default ZSH shell. Although other ZSH frameworks help manage the ZSH configuration, oh-my-zsh is the most popular and easy to configure.

How to install

Linux

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

image

Themes

Among all features in OH-MY-ZSH, I love the set of themes that comes in a bundle with the installation. It visually improves my terminal look and feel. Themes are installed under /home/<user>/.oh-my-zsh/themes/.

$ ls /home/tecmint/.oh-my-zsh/themes/

image

By default robbyrussell is the theme that gets loaded. To change the theme modify the parameter ZSH_THEME=<THEME-NAME> under the .zshrc file.

vi nano ~/.zshrc

image

You have to source (source ~/.zshrc) the file for changes to be effective.

$ source ~/.zshrc

Plugins

There are tons of plugins that are supported by OH-MY-ZSH. Setting up a plugin is quite easy. All you have to do is get the plugin package and add the plugin name in the plugins parameter on the .zshrc file. By default, git is the only plugin that is enabled after installation.

image

Now I will add two more plugins ZSH-autosuggestions and ZSH-Syntax-highlighting by cloning the packages.

$ git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

To make plugins effective all you have to do is edit the .zhsrc file, add the plugin name in plugins=() with a space between each plugin name.

$ vim ~/.zshrc

image

Now source (source ~/.zshrc) file for changes to be effective. Now you can see from the screenshot the auto-suggestion feature is enabled and it remembers the command I used previously and suggests based on it.

Useful articles