Sunday, October 28, 2012

Re: surround a visual block with character(s)

On 2012-10-28, Chris Lott wrote:
> What's the most efficient way to visually select a block of text and
> append/prepend a character or more?
>
> In other words, I often want convert this:
>
> blah blah foo foo
>
> to
>
> "blah blah foo foo"
>
> I assume there are plugins that help with this kind of thing, for
> which suggestions are welcome, but I'm curious how to do this most
> efficiently without them.

The way I would do that without using a plugin would be visually
select the block, then type

s"<C-R>1"<Esc>

where <C-R> means Ctrl-R. That will substitute the current
selection with a ", the original selected text from the 1 register,
and another ".

Regards,
Gary

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

No comments: