I've happily used count prefixes on search commands in vim for probably a couple of decades, so I know they used to count correctly. 5n
was equivalent to n
5 times.
As of some recent version, 5n
is sometimes equivalent to n
5 times, and sometimes equivalent to n
6 times.
I can no longer type 5n
, see the cursor stay in the same place while the "search wrapped" message appears at the bottom of the screen, and know that there are 5 whatevers in the file. Which sounds really silly when I try to explain it, but it's apparently something I was doing subconsciously all the time, so the new version is driving me crazy.
What could be causing the search repeat count to behave inconsistently, and how can I fix it?
About my environment: The active options as reported by :set
are
autoindent expandtab ruler ttymouse=xterm
background=dark fileformats= shiftwidth=2 viminfo=
backspace=1 nofsync swapsync= wrapmargin=3
cpoptions=BceFs$t nojoinspaces notextauto
noequalalways noloadplugins tildeop
noesckeys nomore ttyfast
completeopt=preview
formatoptions=tcroq2b
path=.,/usr/include,,,/usr/include/x86_64-linux-gnu
printoptions=paper:letter
runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/
vim80,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg
,.inx,.out,.toc
Some of those settings come from the Debian packaging. The rest are my preferences. I don't do scripting, plugins, or any other fancy stuff.
n
does have logic to repeat count+1 times (see:h n
) but the circumstances in which it happens is somewhat rare groups.google.com/forum/#!topic/vim_dev/cOjJrIk3pZg . Note that this change was made in early 2015. – Mass Oct 26 '17 at 2:37cpoptions
flags (e.g. 'c') can change search fairly dramatically in some cases. Is it possible those flags changed recently? (Suggestion from Mass seems more relevant but leave no stone unturned...) – B Layer Oct 26 '17 at 2:39