Is there script or function for vim to do search of words that is not in proper location (sorry, i don't know how to put it in question) ?

Example: This is a vim user who like the functionality which is pure manual power.

Question: I want to search a sentence which contains words "power, vim , functionality".

I have to remember the order of the keywords to do search:


Only in this way, the result will be yielded. Which is not useful.

But if i don't remember the arrangement of those keywords.. Hence when i do a search :


It will not give me the result i wanted.

What is the solution ?

Thank You in advance.


3 Answers 3


You can use a branch syntax \&,


would find all lines containing all of these three words

Note that the .* are necessary as branch attempts to match all parts at the same location.

  • I just want to know for the sake of more diversity, otherwise i can use :LogiPat to do the search .
    – andrew_ysk
    Sep 24, 2022 at 10:39
  • edited to clarify this is a search pattern
    – Mass
    Sep 26, 2022 at 4:13
  • Somehow i manage to follow your syntax and get it. Thx
    – andrew_ysk
    Apr 8 at 0:00

This is an excellent use case for the LogiPat built-in plugin. LogiPat builds regular expressions using boolean logic.

In your particular example, run:

:LogiPat "power"&"vim"&"functionality"

This uses search() internally. If you want to highlight your matches, type // as usual.


I think this is the only solution, i tried and it works too:



It will highlight the line with the words even when in random order.

  • 2
    this is any of not all of
    – Mass
    May 14, 2022 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.