Hardly any developer can go about his career without interacting with the terminal on daily basis. Many tools continue to be developed as command line apps, like fastlane, Jekyll, and many more … With all that being said, we need to make terminal more usable!
Recently, I’ve been ssh-ing into an Ubuntu server that defaults to bash, and I quickly realized how my terminal life has been completely turned around thanks to zsh. Here are a few examples of why it is just pure awesomeness.
Before I begin, let me just say that I have immediately installed Oh My ZSH right after installing zsh itself, so I am not sure which features are specific to zsh and which are added by the plug-in.
When mentioning the features, I guess I’ll sort them in terms of the most important to me, down to the most “meh”. It’s purely subjective, but here we go:
I can’t get enough of this feature. You simply type a command, then hit the up arrow key, and BAM! You are cycling through your history of that specific command:
This feature saved me countless (accumulated) hours. From running
py.test, adding ssh keys, all the way to simply removing Xcode’s derived data folder:
It is by far my best feature, but the rest of the features are pretty kickass as well.
If you are a lazy typer like me, then you’d feel for me when I say that nothing is more annoying than bash continuously blocking [Tab] completion because many completions exist!
Annoying!!! How does zsh solve that? Well, if you hit double tab, it shows a selection highlight, so you can cycle through the options and choose the command you like!
This is just so convenient…
Once you start typing a command then hit Tab, it can correct your typo automatically, and does so in many ways!
CUSTOM AUTO COMPLETION
With the right plug-ins from oh my zsh, you can have custom auto completion for your favorite commands! Let’s see
git for example:
Not only does it correct it for you, but also allows you to hit
e and edit the command, just in case it didn’t get it right.
zsh ships with a mind reader, really! Look:
I DoNt cArE
As a final note, zsh doesn’t torture you for not getting the CAPS right. It will happily accept wrong caps for files, and correct that for you.
I am not sure where this command comes from, but it is just super for renaming files. All you have to do is autoload it, and then use it. For example, let’s say we have a bunch of png images we want to append
@2x to the end, before the extension:
This is not all … If the rename will mess up your files by overwriting each other, it will detect that and abort the whole operation, leaving your files intact! In case you didn’t understand, let’s see the following example.
Here, I inaptly tried to rename all the images in an Xcode catalog tree to “oops.png” in the root directory. Normally, this command would mean I lose all the images, and only get a single image “oops.png”, corresponding the the last image the command runs on. Not zmv. It gave me a readable error, and aborted the operation. I checked git, nothing changed at all!
YES! Zsh allows you to install custom themes shared by other awesome people, and the choices are just too good. So many different themes, it’s hard not to find what you are aiming for.
My choice was tricky, yet I still found the exact theme I wanted. I need something that shows the cwd on the right, the colors to be according to SMYCK color scheme, displays the active git branch, and nothing else. It must be minimal .. and I found it, the wezm theme:
Here is a dump of more features that collectively make terminal a hell lot more usable.
I am not worried about typing
sudo rm -Rf * anymore.