Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams @semja: let's say you have a variable 'data' and its valid indication 'data_valid'. If I want to search only for 'data' but not 'data_valid', then '/data' won't do the job. I need to tell vim where to stop matching the pattern. Nathan Fellman Mar 30, 2017 at 9:19 This fails in following example: 1word1 See stackoverflow.com/a/22148017/2609994 for a solution. LSchueler Jul 12, 2018 at 9:28 Is there a vim configuration to make it search exact word without wrapping the search string with \< and \< characters? daparic Sep 14, 2019 at 21:45 Because the OP asked to search specifically for "word" . The solution posted here basically does a search for %word% , whether its thiswordisawesome or word56 or 26word . Jguy Jan 6, 2016 at 16:21 Also, because the OP explicitly stated that they know about the / command. As such, this answer is not helpful at all. cmaster - reinstate monica Aug 11, 2016 at 8:57 @jorgesaraiva: 1st of all, you'll probably get an answer faster by asking a new question (rather than waiting for somebody to stumble upon this comment 3 months after you asked it). 2nd of all, you can do :set hls in Vim to highlight your search result. To turn off highlighting do :set nohls Nathan Fellman Mar 30, 2017 at 9:21 This really only works if the first result from doing /word is exactly word instead of word.+ pushkin Jun 8, 2018 at 16:04 this does not work for me on an AWS ubuntu 18.04 instance. using windows git-bash to ssh to the ubuntu server if that is relevant. weird. CodingMatters Sep 30, 2019 at 1:10
  • /pattern - search forward for pattern
  • ?pattern - search backward
  • n - repeat forward search
  • N - repeat backward
  • Some variables you might want to set:

  • :set ignorecase - case insensitive
  • :set smartcase - use case if any caps used
  • :set incsearch - show match as search
  • Basic search (once you have opened the file in vim ) using vim :

    -Hit ESC on your computer keyboard

    -Hit the forward slash symbol on your keyboard /

    -Type the word or symbol you intend to search; for example, to search for the term "rbmq" type /rbmq

    -Hit Enter

    -Hit n to search forward (moving towards the end of the file) and N to search backward (moving towards the beginning of the file)

    How does that answer the question? The OP already shows that they are aware of that. The question is how to avoid matches like 123rbmq123 ... Tomerikoo Mar 27, 2022 at 7:57

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .