Vim for People Who Think Vim is Weird and Hard
I recently read Vim for people who think things like Vim are weird and hard by Harry Roberts, a post that attempts to explain why Vim is worth learning:
I’d watch friends using Vim and be perplexed as to why you’d possibly ever need to type
<Esc>ggdG
to delete the entire contents of a file. How on earth can something so bizarre do that? How on earth do you remember that? In what world does that even make sense?!In fact, the
<Esc>ggdG
example is a great demonstration of misconceptions and misinformation in Vim world. The command to delete the entire contents of a file is simplydG
:d
elete andG
o to the bottom of the file. What<Esc>ggdG
actually does is:
<Esc>
ensures you're in the correct mode.gg
moves your cursor to the top of the file.d
tells Vim to prepare to delete.G
tells Vim to go to the bottom of the file (whilst deleting, as per the previous command).
I love breaking commands down into mnemonics like this, because it does show that with a little bit of effort you can make editing composable rather than tedious.