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

Re: Bug? v:count1 is set to 0

Expand Messages
  • James Vega
    On Fri, Feb 18, 2011 at 3:55 PM, Israel Chauca F. ... At least from my experimentation, it seems to be related to -c/-S. :echo v:count1 works fine when run
    Message 1 of 5 , Feb 18, 2011
    • 0 Attachment
      On Fri, Feb 18, 2011 at 3:55 PM, Israel Chauca F.
      <israelvarios@...> wrote:
      >
      > On Feb 18, 2011, at 1:10 PM, Bram Moolenaar wrote:
      >
      >>
      >> Israel Chauca wrote:
      >>
      >>> v:count1 is set to 0 when I run the following (vim 7.3 patches 1-107):
      >>>
      >>> vim -c 'echo v:count1'
      >>>
      >>> I confirmed this with other people on #vim@freenode, do you get the
      >>> same behavior?
      >>
      >> v:count1 is only set when a command was given.  Does this ever matter?
      >
      > I found out because a text objects plugin didn't work as expected when used with :normal from a file sourced with -S. The problem was that v:count1 was set to 0, but I don't think that should be related to the :echo v:count1.
      >
      > I don't remember how I got to 'echo v:count1', I'll see if I can reproduce the situation again and report back.

      At least from my experimentation, it seems to be related to -c/-S.
      ":echo v:count1" works fine when run interactively, but not via -c.
      Similarly,

      vim -c 'if v:count1 == 1 | echom "1 is 1" | else | echom "1 is 0" | endif'

      puts "1 is 0" in :messages but "1 is 1" if the :if is run manually or by
      :source'ing a script.

      --
      James
      GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>

      --
      You received this message from the "vim_dev" 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
    Your message has been successfully submitted and would be delivered to recipients shortly.