Search for an exact word in Vim command mode

47,357

Use regular expressions:

/\<your_exact_word\>

In other words, enclose your search string between \< and \>

Share:
47,357

Related videos on Youtube

Daniel Ozean
Author by

Daniel Ozean

struct descriptionOf { int elligent_Developer; short list_of_proven_skills; long list_of_ambitions; long long int erest_in_various_technologies; double effort_in_achieving_skills_and_ambitions; float ing_innovator; char of_a_hands_on_doer; }goldenmean; Software Developer with work experience in areas of Video/Image processing and codecs,DSP and multimedia Systems,on DSP/Multicore processor architecures, for devices and applications in Consumer Electronics, Communications industry. Programming languages: C,C++,Matlab/Octave,Python,DSP or RISC assembly languages.

Updated on September 17, 2022

Comments

  • Daniel Ozean
    Daniel Ozean over 1 year

    I want to search for an 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 for an exact word say CIF but I do not want to find CIF_handle or CIF_drv.

    How to make Vim search for exact word in the command mode?

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

  • Daniel Ozean
    Daniel Ozean over 13 years
    @Thanks: workd nicely. Does enclosing the word in \< .. \> make it a regex based search.
  • Janne Pikkarainen
    Janne Pikkarainen over 13 years
    Yes, it's a regex search.
  • scigor
    scigor over 11 years
    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.
  • Edward
    Edward over 7 years
    Sorry, but this is not an answer to the question stated. If you want to add information to the accepted answer, you may want to add a comment over there.
  • Admin
    Admin almost 7 years
    Doesn't work with brackets.
  • eigenfield
    eigenfield over 4 years
    How do you configure vim to behave with an exact word search without needing to wrap it with \< and \> char. Can vim be made to do exact word search by /eightFoldPaths ?