Loading ...
Sorry, an error occurred while loading the content.

Re: vim edit help

Expand Messages
  • vicky b
    Can you please explain more on this section /Array ciwdojox.collections.ArrayList ... -- *Thanks & Regards Vickyb * -- -- You received this message
    Message 1 of 6 , Feb 28, 2013
    • 0 Attachment
      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@...> 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@....
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • vicky b
      actuall i have to 11 such variables can you please help var flightDelay = new
      Message 2 of 6 , Feb 28, 2013
      • 0 Attachment
        actuall i have to 11 such variables can you please help

        var flightDelay = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlConfArlSupId","tvlConfArlcompaid","tvlRepeei","tvlPolRep");
        var baggageDelay = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlProIr","tvlConfArlcompaid","tvlRepeei","tvlPolRep");
        var baggageLoss = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlProIr","tvlListLost","tvlPolRep");
        var tripCacel = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlConfArlcompaid","tvlRrepdsc","tvlPolRep");
        var repariation = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMdRp","tvlRee","tvldc","tvlPolRep","tvladrdc");
        var accidentalDisablement = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMdRp","tvlPolRep","tvladrdc");
        var lossOfTravel = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMhdr","tvlPolRep","tvladrdc");
        var secureWallet= new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMhdr","tvlPolRep","tvladrdc");
        var others= new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlRrepdsc","tvlPolRep","tvladrdc");



        On Fri, Mar 1, 2013 at 12:25 AM, vicky b <vickyb2084@...> wrote:
        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@...> 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@....
        For more options, visit https://groups.google.com/groups/opt_out.





        --
        Thanks & Regards
         Vickyb





        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      • Benji Fisher
        First, the explanation. See the references that Ben Fritz already listed. /Array : Search for the text Array . Do not type literally: it means hit
        Message 3 of 6 , Feb 28, 2013
        • 0 Attachment
          First, the explanation.  See the references that Ben Fritz already listed.

          /Array<CR>:  Search for the text "Array".  Do not type <CR> literally:  it means hit Enter or Return.
          ciw:  Change the word (text object).  You could also use cw or ce (change word or change to end)
          dojox.collections.ArrayList:  This will be added to the buffer, since you are in Insert mode after ciw.
          <Esc>:  Leave Insert mode.  Do not type it literally.

          As for doing it 11 times, I would record a macro, starting before the search command and ending after the :s command.  Roughly, if I want to use the x register for the macro (qx)

          qx
          /Array<CR>
          ciwdojox.collections.ArrayList<Esc>
          ^w"yye
          f(
          dib
          o<Esc>
          p
          :s#"[^"]\+",\?\s*#<C-R>y.add(\0);\r#g
          q

          (Note that I have yanked into the y register instead of typing the word "illness" literally.)  If all of the works, then you can repeat it with

          @x
          @x
          8@x

          :help recording

          -- 
          HTH
          Benji Fisher

          On Thu, Feb 28, 2013 at 1:59 PM, vicky b <vickyb2084@...> wrote:
          actuall i have to 11 such variables can you please help

          var flightDelay = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlConfArlSupId","tvlConfArlcompaid","tvlRepeei","tvlPolRep");
          var baggageDelay = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlProIr","tvlConfArlcompaid","tvlRepeei","tvlPolRep");
          var baggageLoss = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlProIr","tvlListLost","tvlPolRep");
          var tripCacel = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlConfArlcompaid","tvlRrepdsc","tvlPolRep");
          var repariation = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMdRp","tvlRee","tvldc","tvlPolRep","tvladrdc");
          var accidentalDisablement = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMdRp","tvlPolRep","tvladrdc");
          var lossOfTravel = new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMhdr","tvlPolRep","tvladrdc");
          var secureWallet= new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlMhdr","tvlPolRep","tvladrdc");
          var others= new Array("tvlPlyCp","tvlPlcyCertID","tvlShdIt","tvlRrepdsc","tvlPolRep","tvladrdc");



          On Fri, Mar 1, 2013 at 12:25 AM, vicky b <vickyb2084@...> wrote:
          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@...> 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@....
          For more options, visit https://groups.google.com/groups/opt_out.





          --
          Thanks & Regards
           Vickyb





          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           

          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
           
           
        • Marc Weber
          ... [..] Why? it will be more bytes to sent to the client. dojox documentation says there is addRange(array) - maybe it just does what you re looking for. If
          Message 4 of 6 , Mar 1 2:12 PM
          • 0 Attachment
            Excerpts from vicky b's message of Thu Feb 28 19:33:23 +0100 2013:
            > 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")
            [..]

            Why? it will be more bytes to sent to the client.
            dojox documentation says there is addRange(array) - maybe it just
            does what you're looking for.

            If not you can create a helper function, too:

            funtion new_dojox_collection(){
            var r = new ..
            for each elem in argumets
            r.add(elem)
            return r;
            }

            You can solve it by vim, but you don't have to. such shortuts can make
            sense if you use them a lot.

            Marc Weber

            --
            --
            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@....
            For more options, visit https://groups.google.com/groups/opt_out.
          Your message has been successfully submitted and would be delivered to recipients shortly.