3

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:

/vim.*functionality.*power

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 :

/power.*vim.*functionality 

It will not give me the result i wanted.

What is the solution ?

Thank You in advance.

0

2 Answers 2

4

You can use a branch syntax \&,

.*power\&.*vim\&.*functionality 

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.

-2

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

/word3\|word1\|word2  

  

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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