To search a file, type
/ (search forwards) or
? (search backwards) and enter the word.
Normally, Vim will check for upper and lower letters. But you can set two different options in your configuration file (
~/.vimrc or similar):
pattern 'ignorecase' 'smartcase' matches ~ foo off - foo foo on - foo Foo FOO Foo on off foo Foo FOO Foo on on Foo \cfoo - - foo Foo FOO foo\C - - foo
:set incsearch - show match as search proceeds :set hlsearch - search highlighting
Vim will jump to the first match. Hit
Enter if you’re finished with typing. Then you can circle through all matches with
n (forwards) or
You can also search for the current word. Press
* and Vim will search forwards. With
# Vim will search backwards.
Both commands will do an exact search. If your cursor is on the word
for, it won’t match
forwards. You can fuzzy search with
? and arrow keys for your search history.