Thursday, February 28, 2013

Re: vim edit help

Can you  please explain more on this section

/Array<CR>
ciwdojox.collections.ArrayList<Esc>


On Fri, Mar 1, 2013 at 12:17 AM, Ben Fritz <fritzophrenic@gmail.com> wrote:
On Thursday, February 28, 2013 12:33:23 PM UTC-6, vicky b wrote:
> HI All,
>
>
>  I have text in below format 
> var illness = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlRepMedEi","tvlMdRp","tvlRrepdsc","tvlPolRep")
>
>
>
>
> i need to convert it 
>
>
>
> var illness = new dojox.collections.ArrayList();
> illness.add("tvlPlyCp");
> illness.add("tvlPlcyCertID")
>
> illness.add("tvlShdIt")
>
>
> illness.add("tvlRepMedEi")
> illness.add("tvlMdRp");
> illness.add("tvlRrepdsc");
> illness.add("tvlPolRep");
>
>
>
> Can anybody help me on this--
> Thanks & Regards
>  Vickyb

Here regular expressions are your friend.

I'd start by changing the "new" line to be correct:
/Array<CR>
ciwdojox.collections.ArrayList<Esc>
f(
dib

Now paste the deleted list of initializers on a new line and put it in the right format:
o<Esc>
p
:s#"[^"]\+",\?\s*#illness.add(\0);\r#g

Done!

All this is untested but it's pretty straightforward so you should be able to fix it.

Help topics so you know what you're doing:
:help text-objects
:help :s
:help /\0
:help /[
:help /\+
:help /\?
:help /\s

--
--
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/groups/opt_out.





--
Thanks & Regards
 Vickyb


--
--
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/groups/opt_out.
 
 

No comments: