vim 8.1.1270 (May 2019) :set shortmess-=S
Since May 2019 vim offers the possibility to show the count in the statusline (as long as it less than 99) which however is disabled by default. Add to your vimrc
set shortmess-=S
or activate it on demand with
:se shm-=S
Following additional information can be found under :h search-commands
When 'shortmess'
does not include the "S"
flag, Vim will automatically
show an index, on which the cursor is. This can look like this:
[1/5]
Cursor is on first of 5 matches.
[1/>99]
Cursor is on first of more than 99 matches.
[>99/>99]
Cursor is after 99 match of more than 99 matches.
[?/??]
Unknown how many matches exists,
generating the statistics was aborted because of search timeout.
Note: the count does not take offset into account.
a:word
bygetreg("/")
and then use the function in your status line. You will probably need totry...catch
to handle unset search register and not found occurrences.