Thursday, August 10, 2017

Re: wrapping a series of comma separated words

On 10/08/2017 18:57, Chris Lott 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!

I have never used emmet, but I'd use Tim Pope's Surround plugin for
that. Move at the beginning of the text to be wrapped, then type

yst,ti>

Explanation:

ys = invoke "yank surround"
t, = till the next comma
t = wrap with a tag
i> = the <i> tag

If you also install the Repeat plugin, the action will be
dot-repeatable. So, typing W. repeatedly will wrap the subsequent
words. Of course, if you find yourself doing this often, you might
define a mapping for the sequence above.

Enjoy,
Life



--
--
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