Oh My Glob: alias expansion in zsh
Katie McLaughlin
Posted on March 12, 2020
I'm just getting on the zsh train, and while a lot of my personal customisation work has been around getting zsh to look like my old bashrc setup, I just learnt of one new feature that I never used in bashrc that is going to make my zsh experience much more friendly, especially to those looking on when I'm coding.
Alias Expansion is a concept where when you declare an alias
alias serveme="python -m http.server 1337"
Instead of just typing the alias, you hit a key sequence and it expands for you
By using the globalias
ohmyzsh plugin, this automatically happens when you hit space.
$ serveme▊
$ python -m http.server 1337 ▊
Which is really nifty because there's no extra key presses required, and it helps you remember the full command (extra points!).
But not only that, it means that you can greatly improve your demos especially when you have super long commands to run all the time.
For example:
$ tail ~/.zshrc
alias ka="kubectl apply -f"
$ ka▊
$ kubectl apply -f ▊
Shout-out to Mark for the tip!
Posted on March 12, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.