This section is a condensed version of Bram Moolenaar's article from 2000, and a subsequent presentation from 2007. It's rather good, give it a read on Bram's website: https://moolenaar.net/habits.html. In case you decide to skip reading the whole thing, here follows a very high-level summary.
Since developers spend so much time reading and editing code, Bram highlights an important cycle when it comes to improving your text-editing experience:
- Detect inefficiency
- Find a quicker way
- Make it a habit
Those three steps are augmented with numerous examples. Here's one of the examples for each:
- Detect inefficiency: Moving around takes a lot of time.
- Find a quicker way: Often, you're looking for something that's already there. You can search for a piece of text to move faster. Or you can take a step or two further:
-
- Use * to search for a word under the cursor
- Use :set incsearch to search as you type
- Use :set hlsearch to highlight every instance of a search pattern on the screen
- Make it a habit: Use what you've learned! Set incsearch and hlsearch in your .vimrc. Use * every time you catch yourself using the / command to search for a pattern near your cursor.