When I search backward a pattern that contains a repetition of characters, vim doesn’t always positions on the last occurrence of the pattern in the matching line if the matching line contains repetitions of the searching pattern. More precisely, my file is
A
B
abababababababXXXababababababababababababababMMM
12345678901234567890123456789012345678901234567890
ababababab
C
D
E
I am in the Normal Mode. My current line is D and my search is
?ababababab
After the search the cursor column position on the line with ababab ...
will be 28 and not 36 as I would expect.
If I’m searching backward ?abab
the column position will be the right one, i.e. 42; but in this case when searching in the line after 1234 ...
the column position will be 40 and not 42.
If I'm searching ?ab
it will react correctly.
Can someone explain this strange behavior of Vim?
I’m using Vim Version 8.2 Last change: 2022 May 13 on OpenSuse and Fedora Linux distributions. I did no settings on my own in Vim.
I think that a new tag "backward-search" would be useful. As I’m new in in stackexchange I let other experienced users to create this tag and add it to this question.