I often need to find several keywords in a sentence.
For example: This is just a sentence of word1 word3 word4 word2 text in my huge Vim data file.
I can't remember the exact pattern of search, hence I need a search that can do that:
Is there way or plugin that enable search of multiple keywords that are not in correct order in a sentence?
For example: I am searching for these keywords (/word1,word2, word3, word4) in a sentence, but in actual fact the order was not like what I thought it was.
:Linesor:BLinescommand would do what you're asking. – mattb Aug 11 '22 at 06:59:grep ''\bword1\b|\word2\b'(with ripgrep as:h grepprg). This will return lines where either or both of these words are present. I'd then do av:word1:dandv:word2:din the quickfixlist, which will get rid of the lines where both the words aren't present. And if this were to be a regular operation, I'd write a vimscript function to automate the steps. Lemme know if it helps or if you want me to write the function. I don't wanna work in vain otherwise. – 3N4N Aug 11 '22 at 07:07