Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to search a exact word in vim in command mode(using Vim command /wordtosearch , NOT the search of the current word at the cursor using * or # commands) e.g. I would like to search an exact word say CIF but I do not want to find CIF_handle or CIF_drv..

How to make vim search exact word in the command mode?

(I don't mid the case of the word searched, because i already have ignorecase set.)

Thank you.

-AD.

share|improve this question
up vote 11 down vote accepted

One way to do this: /\<your_exact_word\>. In other words, enclose your search string between \< and >\

share|improve this answer
    
@Thanks: workd nicely. Does enclosing the word in \< .. \> make it a regex based search. – goldenmean Oct 29 '10 at 10:19
    
Yes, it's a regex search. – Janne Pikkarainen Oct 29 '10 at 10:22
    
But what do u do if u need to search for a string like "1...". It will highlight all numbers starting with 1 and not the string with the dots. – inf.ig.sh Nov 9 '12 at 10:43

I just had tried to use /\<*> to search literally * sign in vim, obviously it also counted space in the list. here is the possible way to do it in a Very Nomagic way,

/\v*

for for more detail :help \V

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .