Re: Bug? v:count1 is set to 0
- 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.
> 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.
":echo v:count1" works fine when run interactively, but not via -c.
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.
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