Hi all,
We recently received an issue about using :vimgrep in the Go plugin
govim.
In govim we handle `BufRead` autocommands for .go files, and send notifications to the Language Server that a new file has been opened.
As :vimgrep search through files, we do get autocommands for each and every file, but sending notifications for all .go files searched will put a lot of load on the language server as it thinks that the user actually opened (and closed) all files searched within just a second.
Is there a way to differentiate BufRead autocommands triggered by :vimgrep from others? It would be great if we could identify those and filter them, or even better if they didn't trigger autocommands in the first place.
I also noticed that vim will keep the same buffer numbers as :vimgrep search through files without a match. If it do find a match the file & buffer is kept and the buffer number is increased. For those we obviously do want the autocommand as they are indeed opened.
Are there cases where we should expect that a buffer number is reused within the same vim session?
Regards, Pontus