How do I see the search match count in the statusline?
Answer
:set shortmess-=S
Explanation
The shortmess option controls which messages are shortened. Removing the S flag shows the current match count (e.g., [3/15]) when searching.
How it works
:set shortmess-=Senables the search count display- When you search with
/orn, the count appears - Shows
[current/total]format
Example
After searching /error:
/error [3/15]
This shows you are on the 3rd of 15 total matches.
Tips
- Available in Vim 8.1.1270+ and Neovim
- The count updates as you press
nandN :set shortmess+=Shides the count again:%s/pattern//gnis an alternative for counting matches- Some statusline plugins show this information as well