In Vim or vi text editor, you can search for a word in the following ways:
- Normal mode search:
- Press the
/key to initiate a forward search. - Type the word you want to search for.
- Press
Enterto initiate the search. - Press
nto move to the next match, orNto move to the previous match.
- 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
nto move to the next match, orNto move to the previous match.
Note: In both cases, you can use ? instead of / to initiate a backward search.