Learning Vim by Editing Git Messages

Published:

Vim can be intimidating, but I’ve found a pleasant way, to learn (or maybe more specifically - practice!) the basics - by using this editor to write Git commit messages.

When I first learned Git, I’ve been either using external tools or making commits like this: git commit -m "My first commit".

I didn’t realize at first, that when you just enter git commit, a selected editor pops up. Often the default is Vim.

That way, I could train basics of moving back and forth in the text, learn about the insert and normal mode and finally, save and exit from vim, finishing the commit.

It’s not like I use vim for everyday coding work. I’m more an IDE guy. But I really extensively use vim when I need to edit a file on a remote environment via SSH. Also recently, when editing Kubernetes Yamls, I use those Vim skills, which I first gained back when I was starting with simple one-line commit messages.

Training

Obviously, in order to train, you need to learn how to exit Vim in the first place.

The manual is an obvious source of knowledge, however there are other resources worth checking out:

Going through the vimtutor would be more than enough to get yourself up and running.

Did you like the blog post?

0