In normal mode with default mappings, suppose I type
/[,_@]. This then causes all matches of that pattern to be highlighted. Is there some way to examine the results of this search? I am specifically interested in:
- the start and end positions of each match,
- the number of matches in the file,
- the number of matches between my cursor and the end of the file.
Is it possible to obtain this information, for use in further scripting?
If possible, I would like a solution that works without having to explicitly pass a filename, because I want it to be usable when editing text read from stdin or on a new buffer (as with
:enew). This, as far as I can tell, disqualifies the use of
:vimgrep which requires a filename.
I am aware of the
search() function, but I'm not sure if it helps here.
Also, I use Neovim, so I will accept a Neovim-only solution.