Friday, May 8, 2015

Re: search for a list of words

On Friday, May 8, 2015 at 9:28:49 AM UTC-4, Tim Chase wrote:
> On 2015-05-08 15:17, Fetchinson . wrote:
> > Is it possible to search for a list of words?
> > I mean if I have a text I'd like to search for
> > either 'foo' or 'bar' and when the matches
> > are highlighted, I'd like to be able to jump
> > between the matches (which include both
> > words 'foo' and 'bar').
>
> Depending on your criteria, you can do the easy-but-sloppy
>
> /foo\|bar\|baz
>
> or you can wrap it in conditions to ensure whole-words:
>
> /\<\(foo\|bar\|baz\)\>
>
> so you don't find things like "barn" or "buffoon".
>
>
> -tim

So the next obvious question: what fancy magic would it take to have a <meta> #|* that would add the word under the cursor to the search list?

The user would find the first word to search and hit * to find the other occurrences. The user then finds a new word and wants to search for both, so they would hit <meta>* and instead of replacing the search string, it would append to it. Using regular * again would reset the search string back to the single word under the cursor.

Obviously this would work for # too.

ps: what are the odds someone has already solved this?

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment