Thursday, August 25, 2011

Re: Autocommand event for new buffers including startup buffer

All I'm trying to do is prevent a particular plugin (delimitMate) from
automatically turning on. The plugin just auto-closes matching
delimiters, like parentheses, brackets, etc. However, the auto-closing
behavior turns on by default in every buffer, whereas I would prefer it
to be off by default, but toggleable via the :DelimitMateSwitch command
that the plugin provides.

You can stop it from loading in general by setting loaded_delimitMate. I
could do it globally in my .vimrc, but that would prevent the plugin
from loading altogether, meaning that not just the auto-closing behavior
would be turned off, but so would the commands to toggle it on. What I
want is for it to still load (so that the commands that the plugin
provides are still available), but not actually take effect in any
buffer automatically. If you set loaded_delimitMate in buffer scope
rather than globally, it has exactly this effect.

So all I want to do is to automatically set b:loaded_delimitMate in
every buffer when the buffer is first loaded, including no-name buffers.
That seems more difficult than I expected it to be. I don't understand
why so many autocommand events are not triggered for no-name buffers.

The BufWinEnter event you mentioned does work in no-name buffers, but
it's apparently being triggered after the plugin takes effect, because I
still get auto-closing parentheses when I use it.

Really, the plugin should just include an option to be off by default,
but it doesn't. You can turn it off for specific filetypes, but there's
no way to say "all filetypes". Maybe I'll just modify it myself to work
that way, if no one has any better suggestions.

--
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: