On Thu, Aug 10, 2017 at 11:57 AM, Chris Lott <ch...@chrislott.org> wrote:

> I'm constantly needing to wrap a series of comma separated titles with
> html <i> tags, so this:
>     John has published work in foo, fubar, boo review, and many more.
> Becomes this
>     John has published work in <i>foo</i>, <i>fubar</i>, <i>boo
> review</i>, and many more.
> Right now I'm visually highlighting each title and using emmet to wrap
> with the tags, but it seems like there must be a shorter way!

The basic idea is to use


I am using '#' instead of the usual '/' so that I do not have to escape '/'
in the replacement.  If you can afford the extra character, then this is


Note that '&' in the replacement corresponds to the matched text.  (:help

     The question is what pattern to use.  If you use '\k\+\ze,' then it
will match a "word" preceding a comma:  in your example, "foo", "fubar",
and "review".  The question is how to get "boo review" and not "in foo".
One possibility is to match either '\k\+' before a comma or '[^,]\+' after
", " and before ",", so the full pattern is ',\s*\zs[^,]\+\ze,\|\k\+\ze,'
and the full command is


Benji Fisher

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

Reply via email to