Thursday, April 28, 2011

Re: ":windo g/pattern/q" peculiarity

On 04/28/2011 01:15 PM, Jean-Rene David wrote:
> * Tim Chase [2011.04.28 14:00]:
> [...]
>> :windo g/pattern/q
>>
>> which did as I expected, but had the odd side effect of printing
>> misleading messages about additional/fewer lines:
>>
>> 193 more lines
>> E486: Pattern not found: @
>> 86 fewer lines
>> 16 fewer lines
>> E486: Pattern not found: @
>
> I can't reproduce this on terminal vim 7.3.143. I had two files open:
>
> $ cat /tmp/foo
> 1+2
> @11+12
> $ cat /tmp/bar
> barou
>
> and used both '@' and '1' as patterns.
>
> I get the E486 error but not the more/less lines messages.

Because each of your files have the same number of lines, it
doesn't register a change. For a full example:

bash$ cd ~/tmp; mkdir moreless; cd moreless
bash$ for i in 10 20 30 40 50; do seq $i > ${i}.txt ; done
bash$ sed -i '5s/$/@/' 30.txt
bash$ sed -i '10s/$/@/' 50.txt
bash$ vim -o *.txt
:windo g/@/q

produces (on the stock 7.2.445 that comes with Debian Squeeze)

E486: Pattern not found: @
E486: Pattern not found: @
10 more lines
E486: Pattern not found: @
10 fewer lines

-tim


--
You received this message from the "vim_use" 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

No comments:

Post a Comment