Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding exact match in vim

Tags:

vim

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?

like image 313
bigTree Avatar asked Mar 03 '14 13:03

bigTree


People also ask

What does control f do in Vim?

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.

How do I change the exact word in vi editor?

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 .


1 Answers

You enclose the string you are looking for by \< and \> like in /\<aa\> to match exactly that string.

like image 54
LSchueler Avatar answered Sep 23 '22 17:09

LSchueler