On Tue, Jul 11, 2006 at 05:54:01AM +0300, Yakov Lerner wrote:
> On 7/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >It is possible to remove all autocmds in the autogroup. However, when I
> >want to temperilly "disable" the autogroup, and "enable" it in the future.
> >I need to copy the source.
> >
> >Example: Suppose there is some autogroup HisAutoGroup in one of my startup
> >scripts.
> >
> >In one of my script, I need to disable the group "HisAutoGroup", do
> >something, then enable all the autocommands in the group again, but do not
> >want to know where the "HisAutoGroup" defined and do not want to copy the
> >source to my script.
> >
> >Any work around for that?
> 
> This is your code, right ?
> 
> If this's your code, you could can solve it like this:
> 
> let g:MyEnableAu=1
> :aug MyGroup
> :au BufRead * if g:MyEnableAu | .... | endif
> :au BufWrite * if g:MyEnableAu | .... | endif
> ...
> :aug END
> 
> Then you can enable/diable all autocommands in the group
> by toggling the g:MyEnableAu variable. Simple.
> 
> Yakov

     Another option (less flexible, but does not require changing the
existing autocommands) is to use 'eventignore' or :noautocommand .
Neither of these lets you specify which augroup should be affected, but
they might be god enough.

:help :noautocommand
:help 'eventignore'

HTH                                     --Benji Fisher

Reply via email to