Searching in Vim

/{pattern}[/]<CR>Search forward for the [count]’th occurrence of {pattern}
/{pattern}/{offset}<CR>Search forward for the [count]’th occurrence of {pattern} and go {offset} lines up or down
/<CR>Search forward for the [count]’th latest used pattern
//{offset}<CR>Search forward for the [count]’th latest used pattern with newIf {offset} is empty no offset is used.
?{pattern}[?]<CR>Search backward for the [count]’th previous occurrence of {pattern}
?{pattern}?{offset}<CR>Search backward for the [count]’th previous occurrence of {pattern} and go {offset} lines up or down
?<CR>Search backward for the [count]’th latest used pattern
??{offset}<CR>Search backward for the [count]’th latest used pattern with new {offset}If {offset} is empty no offset is used.
nRepeat the latest / or ? [count] times
NRepeat the latest / or ? [count] times in opposite direction
:lv {pattern} [g][j] {file(s)}Search in files with internal grep
Results are put into “quickfix list” open with :cw
+ ‘g’ return all matches not just one per line
+ ‘j’ don’t jump to first match automatically
+ for recursive search use ** file pattern like **/*.c

Leave a Reply

Your email address will not be published. Required fields are marked *