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

Re: Count character in line

Expand Messages
  • Klaus Bosau
    ... Thanks a lot! I turned it in fun! s:N() let &report=0 .s/x/&/ge return substitute(v:statusmsg, ^ (. ).* , 1 , ) endfun but this seems to work properly
    Message 1 of 5 , Jan 1, 2003
    • 0 Attachment
      On Wed, 1 Jan 2003, Benji Fisher wrote:

      > :help 'report'
      > e +/Count $VIMRUNTIME/macros/matchit.vim

      Thanks a lot! I turned it in

      fun! s:N()
      let &report=0
      .s/x/&/ge
      return substitute(v:statusmsg, '^\(.\).*', '\1', '')
      endfun

      but this seems to work properly only if typed by hand. When put in a
      function body v:statusmsg still is not set reliably. The 'matchit'
      solution turned out to be quite similiar to the solution I already
      found, but due to that this seems to become a bit slow with large
      strings I'd actually prefer a working solution based on :s. I wished I'd
      know why v:statusmsg isn't set always...

      Thanks anyway!

      Klaus
    • Klaus Bosau
      ... Hi, and thanks! I already tried this, but obviously it sometimes isn t set by :s. I don t know why... Thanks, Klaus
      Message 2 of 5 , Jan 1, 2003
      • 0 Attachment
        On Wed, 1 Jan 2003, Antoine J. Mechelynck wrote:

        > you might set it yourself, e.g.
        >
        > function!...
        > let v:statusmsg = ""
        > .s/ etc.

        Hi,

        and thanks! I already tried this, but obviously it sometimes isn't set
        by :s. I don't know why...

        Thanks,

        Klaus
      Your message has been successfully submitted and would be delivered to recipients shortly.