I was using oh-my-zsh for a really long time and I was pretty happy with it. However, lately I decided to look for an alternative, more specfically - a more performant one. And I stumbled upon Prezto.
Getting rid of oh-my-zsh
As I mentioned, I was using oh-my-zsh
, first thing we need to do is to get rid of it! This can be done pretty easily, you just execute the following shell script:
uninstall_oh_my_zsh
This will perform the uninstallation and will create backup of your current .zshrc
file in the home (~
) directory, the new file will be something like: ~/.zshrc.omz-uninstalled-2019-09-22_08-31-19
.
Installing Prezto
This is pretty easy, you can follow the instructions in the GitHub repo.
If you’ve done everything correctly, you should have your Prezto
installed in ~/.preztorc
directory.
How to “extend” PATH?
You can add your custom directories to PATH
by editing the zprofile
file. Here is an example from the current latest source.
Enabling “vi” mode
If you a fan of vi
, you can enable this mode for your shell. If you haven’t tried it before - I think you should… I am struggling myself to learn some of the most basic vi
usage (may have another blog post on that).
Edit the following line, change emacs
to vi
.
Clipboard
If you want to have your vi
clipboard to work with the system one, you need a plugin. contrib-clipboard is the one that I use. Again, follow the instructions. After that, you need to list the contrib-clipboard
in zpreztorc.
Slow input
Add KEYTIMEOUT=1
to your ~/.zshrc
to eliminate the ESC
delay.
Changing your theme
Just take a look at the author’s instructions.
Personally, I use powerlevel10k
, it has a nice wizard, where you choose the whatever looks best to you! Also, it auto-installs the needed fonts!
Set your NodeJS environment
Add nodenv
Don’t use NVM. It’s sooo slow, one of the reasons I started looking for an alternative to oh-my-zsh
. A quick FAQ why you should choose nodenv
. It’s worth the time (2min read, probably).
It works instantaneously, something which can’t be said for NVM
. Just search for “nvm slow” and you’ll know what I am talking about.
Installation
You should use homebrew
if you are using MacOS
. Just execute the following:
brew install nodenv
Please note that there is a single e
in nodenv
, this tripped me while setting up my shell. There is a nodeenv
formulae as well…
Of course, if you are a developer, you know copy
/paste
is always the way to go. ;)
More detailed instructions you can find in the GitHub repo.
Setting up Prezto
Add the following line: eval "$(nodenv init -)"
in your ~/.zshrc
after sourcing Prezto
.
But it doesn’t work with .nvmrc
Yeah, that’s the drawback. There is a nodenv-nvmrc fork that does just that. I don’t recommend it though. Auto-changing versions between builds is not something I want, especially in a production environment.
Just lock down your NodeJS
version using a .node-version
file!
Conclusion
After a week, I am really happy with my new setup. I forced myself to learn something new and now I am struggling every day in the terminal, because I am using vi
mode.
Also, this post was written entirely in vi
, took a little bit longer than anticipated, but hey, I may start to love it. ;)
Other resource
Make sure to check these awesome blog posts: