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

Re: [Fwd: Re: Numbering a list]

Expand Messages
  • John Little
    While I think Dr Chip s script fit s your stated requirement well (and I ll be thinking of it in similar circumstances), you could bear in ... It applies
    Message 1 of 2 , Sep 1, 2007
    • 0 Attachment
      While I think Dr Chip's script fit's your stated requirement well (and
      I'll be thinking of it in similar circumstances), you could bear in
      mind a very useful idiom I learned from this list, for example:

      :let n = 0
      :g/0/s//\=n/|let n+=1

      It applies particularly well if the things to be numbered are not on
      consecutive lines (though the macro approach does too).
      Of course, I'd usually use an ordinary search until I can see that the
      right things are highlighted, and then maybe apply` \zs and \ze if
      necessary. In your example this might be:

      /, \zs0\ze );

      and then let rip with g//s//. See :help sub-replace-expression.

      To me it was unobvious that in :g//command|command2 the second command
      is governed by the :g. :h :bar explains that vi did it that way.

      HTH, John

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.