oh my zsh
Sat, Sep 5, 2020
I’ve very recently switched to zsh with oh my zsh as my primary shell. I’d seen a colleague make the switch, and didn’t really understand why until I saw his prompt work magic in git repos. The oh my zsh git plugin is fantastic - aside from providing a stable of git-oriented aliases, when you cd into a git repo your prompt will change to reflect which branch you’re in and whether that branch has uncommitted changes.
Come for the git plugin, stay for the tab complete. Being new to zsh, I’m not sure if the tab complete experience I’m seeing is native to zsh or if it’s specific to the oh my zsh environment. Either way, I love it. Tab complete suddenly offers look-ahead completions I didn’t realize I was missing.
Two things that irked me right off the bat:
- tab complete is case insensitive by default
- the default robbyrussell theme’s prompt doesn’t show hostname… ssh much?
Changing the tab complete behavior was incredibly easy - simply uncomment the following line in .zshrc:
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
The second item required a little more research, but was easy enough to achieve. The trick was to add the following PROMPT variable extension at the bottom of my .zshrc:
PROMPT="%{$fg[cyan]%}%m%{$reset_color%}${PROMPT}"
”%m” is the variable for hostname. I made it cyan to match the default prompt’s color and avoid making the prompt any busier.
Now I’m happily typing away in my new shell. There’s so much more that’s available in oh my zsh, and I may get to some of it. I never exhausted bash’s capabilities either. For me it’s the little functional improvements in the things I use all the time that have made this switch so enjoyable.
Cheers!