Thursday, February 9, 2012

vimgrep and bufread* autocommands

Gentlemen, Im having some issues with vimgrep and an autocommand that
is defined on bufreadpost.

I dont want my autocmd to fire while vimgrep is running, but that is
what is currently happening since vimgrep opens every file it scans
into a vim buffer. I would have thought vim would disable autocommands
when running vimgrep for efficiency, but apparently not!

The short story is that I want an autocommand definition like this:

autocmd bufreadpost * if VimgrepIsNotRunning() | echo 'foo' | endif

So far my only idea is to add a couple more autocommands on
QuickFixCmdPre and QuickFixCmdPost to set a magic flag to say that a
quickfix command is running. That would probably work, but I can also
see it causing more bugs, and its a pretty crap solution in general.

Any suggestions would be welcome :)

FYI, this issue came to light in this bug report in syntastic -
https://github.com/scrooloose/syntastic/issues/161

--
You received this message from the "vim_use" 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

No comments: