Closed ronakg closed 8 years ago
Activating all the usual Vim events when doing the replacements is not really an option. Several events would be sent that people may not expect, and may trigger undesired autocommand calls. It would also require quite a few changes that may result in more complex code.
I could manually trigger BufWritePost
. I'm not sure about doing this by default, as there may still be some people using autocommand not suited to this. For instance, there might be one that auto-compiles a changed file, and depending on how long it takes, that may or may not be what you want after updating 100 files at once. So perhaps a plugin option would be best, like g:qf_replacement_events=BufWritePost,...
.
Alternatively I could trigger a custom event, like QfReplacementBufWritePost
. This is the least confusing solution. It also does not require adding more plugin options. The downside is that obviously autocommands need listen to this custom event, which makes it difficult to use in other Vim plugins that do not know it.
Any thoughts? Would the custom event be enough for you?
Custom event would work for me. From what you've explained above, that looks like the safest approach as well considering no one else has asked such a change before.
see https://github.com/stefandtw/quickfix-reflector.vim#events
Let me know if that works for you.
This is perfect, thanks.
I have a
BufWritePost
for specific files which triggers a database update. When those files are written byquickfix-reflector
, theBufWritePost
autocmd is not triggered.