Zsh is an amazing shell, and Oh-my-zsh is very good at showcasing its power without having to dive into too much configuration. I recommend it to Zsh first-timers: within minutes they can enjoy autocompletion on steroids, crazy prompt tweaking, git integration as well as many other plugins.
BUT. It’s God. Damn. Slow!
Wanna spend the night happily coding and hacking in the “zone”? Here, wait for 1 long second (or more) whenever you open up a new terminal window/tab. Are you triggering tab autocompletion? Oh boy. Come back tomorrow.
Enter Prezto, a.k.a the “Instantly Awesome Zsh”. It began as a fork of Oh-my-zsh, but was later completely rewritten with optimization in mind, and moved to its own repo.
Here’s how I migrated in order to have the exact same behavior as before, while still having a fast shell. Yes, I like to have my cake and eat it too.
- Backup your existing configuration:
~/.zshrcand your possible other dotfiles
- Uninstall Oh-my-zsh by running
- Install Prezto by following the quick instructions on the github repo
Done. You now have a bunch of symlinked
.z<something> dotfiles in your home folder.
Fiddling with the dotfiles
- If it annoys you, remove the possible example instructions in
~/.zlogout(such as displaying a fortune every time you login)
- Put back all your aliases and other customizations into
1 2 3 4 5 6 7 8 9 10 11 12
- If you like to organize your exports/aliases/etc into separate files,
have a look at the other dotfiles. I personally don’t do that and just have one massive
Customizing the prompt
Now to the fun part!
Prezto contains half a dozen example themes compared to the 140 (!) ones of Oh-my-zsh. If you have a custom prompt like me, you will need to tinker a bit.
My theme is quite minimalist: just display the current path followed by
$ and a space.
When in a Git repo, I like to display the branch name followed by a dirty/clean indicator like so:
At the time of writing, most Prezto themes use
vcs_info which can detect staged and unstaged changes (i.e. a dirty state).
But there’s no hook for a clean state, so when there are no changes, the prompt will just display nothing.
I would much rather have a satisfying green little tick that means
“Nothing else to do! Well done mate, you can have a beer* now”.
For this, we need to use
git-info from the Prezto
git plugin. I ended up with this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
I then saved the theme in
and made Prezto use it by having this line in
Last bits and pieces
- I added
1 2 3 4 5 6 7 8 9 10 11 12 13 14
history-substring-search: when pressing up/down arrows, completes the beginning of a command by searching in the history.
git: adds useful aliases and functions like the
git-info one that we discussed above.
- When pressing tab to complete a command, I didn’t like the category menus,
so I commented these lines out in
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
I also modified this line in order to have red diretories when autocompleting the
- In my
~/.zshrc, I added these zsh options:
1 2 3 4 5 6 7 8 9 10
That’s it, you now have a fast zsh that behaves like before!
I skipped some very minor configurations in this article,
so if you want to review exactly what I’ve done (or if you want to know what kind of crazy stuff I put in my
have a look at the commits in my
EDIT: Hacker News thread