Moving in vi

I recently paired with a colleague who is learning vi. While watching him navigate code, I noticed he almost exclusively used the arrow keys. When I started using vi, I read numerous times that one should avoid using the arrow keys. So, I relayed this advice to him. He, quite rightly, asked "why?". Of course, I should've considered why I was giving this advice before blurting it out. I dregdged up some memory of the articles I had read and explained that it is faster to keep one's fingers on the home row than to move to the arrow keys. However, after making this point, I realized that wasn't the complete explanation.

While it might be faster to keep your fingers on the home row, there is a deeper reason to avoid the arrow keys. Utilizing the arrow keys (and hjkl, for that matter) is the slowest possible way to navigate in vi. Moreover, observing him work with the arrow keys made me realize that this approach often kept him in insert mode rather than inserting text and instinctively switching back to normal mode. Being in an "insert mode mindset" meant that he wasn't thinking about other, faster ways to navigate code. Techniques like searching, moving by word, finding a character, etc., are all only possible in normal mode.

While writing this article, I did a little research to see what others had to say about why the arrow keys should be avoided. Most articles I read stated that it's slow to move from the home row to the arrow keys and that moving one char/line at a time is tedious. However, some people only mentioned the slowness of moving away from the home row (for example). But, the issue of moving away from the home row is not that significant. Although it's slower, it's not nearly as time-consuming as navigating one char/line at a time.

I also wondered why recalling information about moving more than one character or line at a time took me a while. My guess is that when I read the vi articles instructing me to avoid the arrow keys, I had yet to master the more powerful navigation techniques. So, while I understood the speed advantage of not leaving the home row, I lacked the muscle memory to make other forms of navigation faster. As a result, this piece of information didn't stick in my mind.

I must admit that, to this day, I am no navigation master myself. I don't use the arrow keys, but I commit a related sin. I increase the key repeat speed on my machine so that navigating by hjkl doesn't feel so sluggish. Although I use some combinations other than hjkl to move, I'm confident the key repeat crutch is holding me back. Perhaps it's time to disable it...