On 2006-07-31, Christian Ebert <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Consider the following:
> 
> augroup TestLeave
>   au!
>   au VimLeave * echo "hello"
> augroup END
> 
> Now if I do:
> 
> :augroup! TestLeave
> 
> TestLeave is still echoing hello.
> 
> Whereas if I do:
> 
> :au! TestLeave
> 
> TestLeave is deleted.
> 
> Is this a case covered by:
> 
> 
>                                               *:augroup-delete* *E367*
> :aug[roup]! {name}            Delete the autocmd group {name}.  Don't use
>                               this if there is still an autocommand using
>                               this group!  This is not checked.
> 
> Or doesn't it make sense to put an "au VimLeave" in an augroup
> anyway?
> 
> Would be nice if someone could elaborate a bit on this.

To paraphrase Will Rogers:  "All I know is what I read in the 
manual."

":help :autocmd-remove" says,

    :au[tocmd]! [group]     Remove ALL autocommands.

And as you discovered, ":help augroup-delete" says not to execute

    :aug[roup]! {name}

if the group still contains an autocommand.  So to do what you want 
to do, you should use ":au! TestLeave" and not ":aug! TestLeave".  I 
don't think this behavior has anything to do with the VimLeave 
event.

HTH,
Gary

-- 
Gary Johnson                 | Agilent Technologies
[EMAIL PROTECTED]     | Wireless Division
                             | Spokane, Washington, USA

Reply via email to