How to install custom plugins and themes with Oh-My-ZSH
*This post is the 2nd part of my series about iTerm2 and Oh-My-ZSH.
In the first part of this series, we talked about how to install and set up your terminal to get you up and running quickly and with little effort, but with functionality and style.
Now we want to dive deeper, go past the default plugins, and explain a little more about Oh-My-ZSH and how it works.
Table Of Contents
Where to find your plugins and themes
Now that we have set up our iTerm2 with Oh-My-ZSH, let's try to understand what it is we installed and we are the files to configure it.
When we setup up our default plugins in the first part of this series, we simply added them to the array of plugins listed in the ~/.zshrc, like so:
# Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git brew heroku gatsby yarn )
but how did they get installed from there?
What you might not know is that, during our installation of Oh-My-ZSH, all of the plugins that are listed in the official documentation were installed at *~/.oh-my-zsh/plugins. So, that once you add a plugin in the array and restart iTerm2, all that Oh-My-ZSH needs to do is to fetch that already installed plugin from the plugin folder and give you a *seeming less experience.
If you want to have a look yourself what plugins you currently have installed simply execute this, to see all the plugins your terminal:
Or this to view in your Finder:
The same counts for your themes! On installation of Oh-My-ZSH, lots of different themes were installed for you to be accessed at any time. Just swap out plugins for themes in your terminal command and you will see all the current themes installed.
To see installed themes in your terminal:
Or to see them in your finder, write:
From here, you can go off on your own and look around in your ~/.oh-my-zsh, try to understand the different subfolders and config files.
However, in this tutorial, we will stick to themes, plugins, and the ~/.zshrc config file to config everything.
So let's get going!
How to install custom plugins & themes
We now know that Oh-My-ZSH looks for plugins and themes in the respective directory under ~/.oh-my-zsh.
So... Does that mean we simply have to create a folder with a custom plugin/theme in that directory and Oh-My-ZSH will be able to source it on start?
That's exactly it.
You add a folder with the custom plugin in your plugin directory and you are good to go.
Some people however prefer to put their custom plugins, themes, and configuration in a "custom" folder within the ~/.oh-my-zsh directory. By default this folder is called: ~/.oh-my-zsh/custom and then for example for plugins go into: ~/.oh-my-zsh/custom/plugins
Oh-My-ZSH will by default be able to source your plugins from there as well, but it's really up to you. You can add your custom plugins to the general plugin directory or your custom plugin directory. It's only personal preference.
One quick note here: Be wary, your terminal might slow down, the more plugins you add to your config. Add your plugins wisely!
Now let's add a custom plugin.
Oh-My-ZSH provides us with a small list of custom plugins to choose from in their official repo:
And in this tutorial, we will go with the most enjoyable one of that list:
This plugin lets doge repeat your command every time you write in your terminal. Wait for it, it's going to be awesome.
To install the plugin we will have to download the plugin and move it into the correct directory. In this case, since it's a plugin: ~/.oh-my-zsh/plugins
Let's do this in one command:
git clone https://github.com/txstc55/dogesay ~/.oh-my-zsh/plugins/dogesay
This clones the plugin from GitHub right into your new dogesay folder within ~/.oh-my-zsh/plugins.
So that now, all that is left to do is to add the plugin to our array of plugins in our ~/.zshrc.
For text editor users:
Or VIM users:
And add the plugin to this list:
# Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git brew heroku gatsby yarn dogesay )
Restart your terminal and done! Every time you enter a command in your terminal doge will make sure you know what you just entered! And with this, you have set up your first CUSTOM plugin.
To get the coloring and bigger font for the callout, you will have to install "figlet" and "lolcat" with:
brew install figlet lolcat
The same process works for all other custom plugins and themes. But if you do have any questions make sure to reach out to me on Twitter 🙂
There are lots of custom plugins and themes out there with a big community developing and maintaining them. It's well worth checking some of them out. Who knows, maybe you might even want to submit a pull request to one of them!
One plugin that I use is:
This plugin lets you create little to-do lists right within your terminal, so you can jot down little things that you need to get done until the end of your day. Hope you like it!