Step 5 of 7

8. Searching

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.

Work through the checklist below. There’s a few instances of HaRd_to_Type_Word hidden among the HAYSTACK strings in the editor — use * to search for them without typing a single letter of the word, n to hop forward, and # to head back.

  1. Search for the word under the cursor Line 1 shows you the word, and its first hidden instance waits nearly 2,000 lines down — put your cursor anywhere on HaRd_to_Type_Word and press *.
  2. Jump to the next instance The second instance is further down — press n.
  3. And the next One more hop lands on the third and final instance — press n.
  4. Head back with a backward word search The backward twin of * lands you on the second instance again — press #.
Search for the word under the cursor Line 1 shows you the word, and its first hidden instance waits nearly 2,000 lines down — put your cursor anywhere on HaRd_to_Type_Word and press *.

Next: Jump to the next instance

Loading editor…