Okay so quite a number of times, I’ve had several people coming up to me, asking about what I did to my terminal that makes it look and work the way it does. On each of those occasions, I’ve had to mention all the things I used for customizing the terminal over and over and over again. So my solution is to describe my terminal setup in this post. I’ll probably also be updating it with the answers to frequently asked questions that I receive as well. So here goes, below is the list of the tools and plugins I use in my terminal.

A customized terminal

First of all, I use the iTerm terminal instead of the built-in terminal that comes with the Mac. iTerm comes with a number of simple, useful features that just work and that are not available in the default terminal app. The features I use the most are:

the ability to split a window as many times as possible and with easy shortcuts to split vertically or horizontally. This is pretty useful when I need to use different terminal instances while working on a project. It makes more sense to have all the instances in one view rather than having to tab through all of them.

the ability to select to copy. As simple as this is, it’s just one of those things that you are glad you have, and it makes you more productive since you have to use lesser commands. Simply Awesome.

the ability to have a hotkey window. This is basically assigning a terminal window to a hotkey combination. You could be using your code editor and use the hotkey to open the terminal which opens as an overlay on the current screen, so you could quickly use it, press the hotkey combo, and it hides again.

the many more features that it has. If you still need convincing, you can find a list of the features here.

This is an awesome ZSH configuration framework. By simply installing it, your terminal instantly gets these new sets of super powers. It’s just awesome. It works on the ZSH shell though, so you would have to move from bash shell or whatever shell you currently use. Personally, I haven’t ran into any issues with using the ZSH shell as opposed to the bash shell that is enabled by default in the terminal. Generally you should have ZSH shell installed, but if you don’t, you can follow the instructions here to install it. To get a brief idea on just what kind of new powers you get with oh my zsh, you can check out their cheatsheet, however that doesn’t list everything. For the full list, you should look at the plugin list. Basically you get a lot of very useful aliases and autocompletions to virtually every important CLI tooling system there is. You would need to enable the plugins in the ~/.zshrc file however to have the plugin specific features. After installing this, the next thing to do is to select a theme to use.

Usually the first thing anyone would notice about a terminal is it’s theme, the way it looks. There are quite a number of themes that could be used but agnoster just works for me. I think it might even be the most popular of all the themes available. Basically all the information you need about your current directory location, git branch, git status, are displayed in a pretty, unobtrusive and simple manner. Especially as a git user, this theme is very useful. No need to run git status to know the state of your branch.

Installing the theme requires a little extra steps to be taken however (as opposed to other themes) to get the font used to render the various icons used within the theme. This process is detailed on the theme’s homepage. After the font for the theme has been downloaded, the theme can be used by modifying the ZSH_THEME="agnoster" line in the ~/.zshrc file, setting the value to “agnoster”. You should then open a new terminal tab to see the selected theme. You would most likely see the prompt with funny looking characters, because the font hasn’t been set yet. You should then open the “Preferences” window and go to “Profile > Text” then click the “Change font” button. If you have downloaded any of the patched fonts, you should see them in the list of the fonts. Selecting any of them should fix the weird characters in the terminal prompt, and the theme should be properly installed now.

At this point, the terminal would probably have a very terrible look in terms of the colors used. For some reason, none of the default color schemes that come with the terminal appeals to me so I found the dracula color scheme which gives the terminal a nice calm look and feel. Installing the color scheme is a pretty straightforward process. You just need to go to their site, check for the iTerm terminal in the list of terminals, and follow the instructions there.

How many times have you written commands at the terminal and there was some syntax error, and you had to go through the command again in bits to try to find where you made the mistake in the command? These kinds of issues are bound to happen once in a while, and unexpectedly too. It gets a whole lot more problematic when you write long complex commands at the terminal. The ZSH syntax highlighting tool helps to solve this by properly highlighting the various parts of your commands, much like your code editor would. Not only that, it also highlights valid commands and invalid ones so you know if a command is available in the terminal or not even before you run it. This improves productivity while working with the terminal. Installing it involves following the instructions here.

This is an awesome little script. It is a definite productivity booster while working in the terminal. It enables you move between directories really quickly, even more quickly than the commands that come with oh-my-zsh would enable you to. What it does is that, after installing it, it tracks your directory usage and learns which directories you use frequently. After a while of using the terminal as you would, the script would have learnt enough to be used for navigation. Using it is also very simple. You just need to pass z a part of the directory name you’re going to and it handles the rest. Next thing you know, you’re in the right directory! So for example, if I regularly use ~/projects/myapp , I could always go to that directory from anywhere by simply entering z my for instance, and it would take me there. Note that this is based on all the directories you use regularly. If there happens to be another directory which you use more frequently that also has my in it’s name/path, that is where z would take you. To install it, you just need to download the z.sh file from the repo into a directory on your system, like the home directory ~ and add the command: . ~/z.sh to source it in your ~/.zshrc file, and that’s it! Open a new tab or source your ~/.zshrc file and the script should be enabled.

And that’s it! All the things I use in my terminal.

Frequently Asked Questions

What do I do if I have some stuffs, like aliases, in my .bash_profile file which I regularly use?

You can always source your .bash_profile file into the .zshrc file, and all your scripts and aliases would be available in zsh as well. Simply adding source ~/.bash_profile into your ~/.zshrc file should fix this.

I have oh-my-zsh installed already, but I re-enabled the bash shell sometime ago. How do I enable the zsh shell?

Simply run chsh -s $(which zsh) which would prompt you for your password and set your default shell to zsh.

Hope this was useful for you guys. Let me know if you have any relevant questions to this. Cheers!