← All lessons

8. Searching

Step 5 of 7

Searching for the word under the cursor

If you’ve got your cursor positioned over an interesting word, you can use the * and # commands in normal mode to quickly initiate a search for it. This is really useful if the word is long and cumbersome to type — like long variable names in code sometimes are.

The difference between * and # is that * will initiate the search in the forwards direction, and # will initiate the search going backwards.

Give it a try. In the editor, there’s a few instances of HaRd_to_Type_Word hidden amongst the HAYSTACK strings. Use the * to initiate a search for HaRd_to_Type_Word, then use n to jump between them.

Loading editor…