Fact: Shell aliases save you time.
Fact: Saving time increases your productivity.
Fact: Everybody wants to be more productive.
Fact: Retraining muscle memory can be a pain in the ass.
I have been fighting that last fact for a while now. I have the single character
v pointed to
vim. A whopping 67% decrease in characters I need to type
vim. After 10+ years of typing in
vim, I found it very hard to break
the habit and transition over to the single character alias.
Then it hit me! Why not break
vim so that I couldn’t run it directly, thus
forcing me to use the alias! And that’s what I set out to do.
To start, I created a
bin directory in my dotfiles, added a new file named
vim and made it executable:
chmod +x ~/.dotfiles/bin/vim
I then opened up the
vim file and wrote the following:
if [[ `ps -o stat= -p $PPID` == *"s"* ]] then
echo -e "e`v`e[0m"
echo -e "ee[0m"
The conditional checks to see if the script is being invoked directly or not.
Without that I was running into issues with other scripts that would call
and updating my
$EDITOR didn’t seem to resolve anything.
After the script was in place, I made a few adjustments to some variables in my
.zshrc file. First, I updated my
v alias to use the full path for my
executable instead of just
And updated my
$PATH to check the
bin I created in my dot files:
With these changes made, I restarted my terminal and am now greeted by this
whenever I try to run
Extreme? Yeah it is, but it’s going to force me to adapt, which is a very good
thing. I’ve spent the last week using that and have absolutely no regrets. I’m
even planning to do the same thing with a handful of other aliases as well!
If you’re interested in seeing which commands you type often and where you would
benefit from some aliases, check out HuffShell, a gem for
suggesting new aliases based on your history.
Also, my dotfiles are available for perusing and poaching if you’re