Error "Pattern found in every line". I expect to get "Pattern not found"

10 views
Skip to first unread message

Igor

unread,
Sep 28, 2022, 4:52:34 AM9/28/22
to vim_use
On latest gVim development 9.0612 downloaded from https://github.com/vim/vim-win32-installer/releases/latest on Windows 10.

Text file:
aaa
bbb


Try to find out all values not maching "aaa"
:v/aaa/p
It outputs:
bbb

So far as expected. Now from text file delete line "bbb" so only line "aaa" exits.
Repeat last command:
:v/aaa/p
It outputs:
Pattern found in every line: aaa

Shouldn't there be:
Pattern not found: aaa

Just like at:
:v/ccc/p
Pattern not found: ccc

Igor

unread,
Sep 28, 2022, 4:54:29 AM9/28/22
to vim_use
Ahhh... last paragraph should be:
Just like at:
:g/ccc/p    --> command "g" instead of "v"
Pattern not found: ccc

Andrew Bernard

unread,
Sep 28, 2022, 5:45:41 AM9/28/22
to vim...@googlegroups.com
It's correct. You file no only contains one line 'aaa'. There is nothing
that is not 'aaa', so nothing to print use :v. The pattern 'aaa' is in
every line, all of one line. That is expected behaviour, though it can
take a while to wrap your head around, but trying to list lines are not
that single line in a single line file is a degenerate case.

Andrew


Reply all
Reply to author
Forward
0 new messages