Tuesday, October 21, 2014

Re: Preferred vim method to put xml tags around selected text

On Tuesday, October 21, 2014 3:05:27 PM UTC-5, glts wrote:
> Hi,
>
> On Tuesday, October 21, 2014 7:49:31 PM UTC+2, russur wrote:
> > At my work, i am having to put specialized xml tags around selected text. So for example i might have:
> >
> >
> > The quick brown fox, jumps over the lazy dog.
> >
> > Now i would have to put:
> >
> > The quick <Node arch="386, 486, 586">brown </Node> fox, jumps over the lazy dog.
> >
> > What is the best/elegant way to do this in Vim?
>
> You could use surround.vim:
>
> https://github.com/tpope/vim-surround
>
> Place your cursor on 'brown' and type
>
> ysiw<Node arch="386, 486, 586">
>
> Mnemonic for this command: 'you surround' inner word.
>
>
> --
> David

I will try that. In the interim I put the surrounding text into register o, and then did the following:

vx"oP%P

visually select my text
cut that text
Paste before from register o
go to the beginning < character of the ending xml tag
Paste the cut text before 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: