Saturday, July 25, 2020

How can I find where one word is close to another word?

As most people on this forum are likely aware, searching for a word is straight-forward enough. If I want to find occurrences of the word 'arc', I can type / arc , with spaces around the three letters, to find basic occurrences of the word (ignoring punctuation). But suppose I want to find where two words are close together, say, within ten words? Here's an example:

Now is the time for all good men to come to the aid of their country.

In this test, I want to find all occurrences where the word 'aid' is within ten words of the word 'country'. How can I do that in Vim?


This is cross-posted on Vi and Vim Beta.


Thanks!

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/b8c05daf-96a6-4840-929e-388f64e2ea37o%40googlegroups.com.

No comments: