Using /
or ?
enables to find a match for a word in vim. But how can I find an exact match?
For example, my text contains the following words: a aa aaa aaaa aa
and I type /aa
This will find all the strings containing the pattern aa, but what if I want to find exactly aa
and not aaaa aaaa
?
CTRL-F is a vital keystroke to control vim - it provides the page-down behavior and without that I have to find the actual page-down key which takes my fingers off the home row.
Press y to replace the match or l to replace the match and quit. Press n to skip the match and q or Esc to quit substitution. The a option substitutes the match and all remaining occurrences of the match. To scroll the screen down, use CTRL+Y , and to scroll up, use CTRL+E .
You enclose the string you are looking for by \<
and \>
like in /\<aa\>
to match exactly that string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With