How to find a Word in Vim or vi text editor

In Vim or vi text editor, you can search for a word in the following ways:

  1. Normal mode search:
  • Press the / key to initiate a forward search.
  • Type the word you want to search for.
  • Press Enter to initiate the search.
  • Press n to move to the next match, or N to move to the previous match.
  1. Visual mode search:
  • Highlight the text you want to search for in visual mode.
  • Press * to initiate a forward search for the selected text.
  • Press # to initiate a backward search for the selected text.
  • Press n to move to the next match, or N to move to the previous match.

Note: In both cases, you can use ? instead of / to initiate a backward search.

(https://casadelninobilingual.com)

Leave a Comment