Hi all,

We recently received an issue about using :vimgrep in the Go plugin govim 
<https://github.com/govim/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.

I can't find any information about if this is expected, except for the "Vim 
Buffer FAQ" over at https://vim.fandom.com/wiki/Vim_buffer_FAQ. According 
to that FAQ a buffer number should never be reused.

*Are there cases where we should expect that a buffer number is reused 
within the same vim session?*

Regards, Pontus

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/d8cef0cb-fe57-413a-9294-c3685c50cb82n%40googlegroups.com.

Raspunde prin e-mail lui