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

32850Re: put count into register

Expand Messages
  • Brett Pershing Stahlman
    Oct 2, 2002
    • 0 Attachment
      I would write a short little function using function search() (:help search)
      in a counter loop. Be sure to set the no wrap argument when calling the
      function as described in the documentation. Also be sure you start out by
      setting cursor at the beginning of the file.

      Brett S.

      ----- Original Message -----
      From: steve felt <steve@...>
      To: <vim@...>
      Sent: Wednesday, October 02, 2002 1:58 PM
      Subject: put count into register


      > Hello, all!
      >
      > I would like to count things. I know that if I want to know how many of
      > something there are, I can hack it with
      >
      > :%s/\(my favorite regex\)/\1/g
      >
      > the result:
      > 65 substitutions on 23 lines
      >
      > However, when things are more complex, ie part of a script, how can I do
      > this cleanly, for example:
      >
      > count the number of occurrences of regex x
      > put the count into a register
      > add to it the number of occurrences of regex y?
      >
      > -steve
      >
      >
    • Show all 5 messages in this topic