What is Oh My Zsh?
According to the official site Oh My Zsh is an open source, community-driven framework for managing your Zsh configuration. What I love about it is the nice GitHub shortcuts and integrations, a clean looking terminal window and intelligence for autocomplete paths and files. However, you can really just do without it and setting up your own environment is a fun exercise so let’s get get cracking!
I prefer to use iTerm2 as my default terminal, but all these steps can be equally applicable to the terminal your machine is shipped with. I’ll also be using vsCode as my text editor of choice.
Let’s get started !
First of all launch VS Code and open the Command Palette (Cmd+Shift+P) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH command. Now you should be able to open iTerm and type code ~/.zshrc. Your Mac OS should be using Zsh as the default login shell if you are running an OS of Catalina or later. However, if you have an earlier version then you can either configure your Bash with the steps below or touch a .zshrc file and use it as the default shell in iTerm by typing touch ~/.zshrc in iTerm and making sure the Command setting is correct in you General settings.
First of all .zshrc does not come out of the box with any caching or history so I find it helpful to have these configured.
We can also configure some colors at the top of the file if you like.
Zsh has a pretty healthy plugin ecosystem so I’ll just cover a couple of my faves here.
Auto suggestion does pretty much what you would expect. You can find the install instructions here (basically just clone it down) and then have this line in your .zshrc.
Pure creates a nice and clean looking interface for you. Here’s the GitHub for cloning.
You can customize the look of the plugin, here’s how I have mine set.
Syntax highlighting is another handy tool and you can find it and clone it here.
iTerm will need to know about the changes in your .zshrc so you either need to open a new iTerm window or run source ~/.zshrc to execute the file. Source is just a built-in command that tells our machine to read and execute the contents of a file. Also note that I am storing my plugins in my ~.zsh directory. You could store yours wherever you like, but just make sure the directory is correctly pointed in your .zshrc.
Git alias commands
These could be whatever you find yourself typing into the terminal time and time again. Some of these I got used to from Oh My Zsh, but I’ve also thrown in a couple of extra that I find handy.
I also like to bring in a color pallet since we’ll likely be staring at this terminal for far too long. Here’s a list of some of the available pallets. I like to clone down the entire repo and import all the .itermcolors files into iTerm so you can flip through them whenever you want to switch it up.
Bonus, if you’re using a version management tool such as NVM or YVM don’t forget to include it in your .zshrc.
That’s pretty much it! If you come across any other fun plugins I’d love to hear about them!