Hari Krishna Dara wrote:

> I am observing what might be inconsistency in the order in which vim
> fires autocommands. First, ovserving the order of buffer and window events,
> 
> - Using :new:
> 
> WinLeave
> WinEnter
> BufLeave
> BufEnter
> 
> - Using :wincmd w
> 
> BufLeave
> WinLeave
> WinEnter
> BufEnter
> 
> 
> When combined with tab operations,
> 
> - Using, :tabe:
> 
> WinLeave
> TabLeave
> TabEnter
> WinEnter
> BufLeave
> BufEnter
> 
> - Using :tabnext:
> 
> BufLeave
> WinLeave
> TabLeave
> WinEnter
> TabEnter
> BufEnter
> 
> Extrapolating the first two, I was expecting these to be
> 
> - For tabe:
> 
> TabLeave
> TabEnter
> WinLeave
> WinEnter
> BufLeave
> BufEnter
> 
> - For :tabnext:
> 
> BufLeave
> WinLeave
> TabLeave
> TabEnter
> WinEnter
> BufEnter
> 
> Is the existing behavior expected? Does anyone agree that it is
> inconsistent? I am even surprised that they should differ between
> switching between the existing windows/tabs and creating new ones.

The problem with autocommands is that they must run in a valid
environment to avoid trouble (as in a crashing Vim).  This is quite
tricky, especially in combination with error handling (e.g., not being
able to abandon a buffer).

The order of autocommands changed at a late moment in 7.0 development to
work around problems (no valid window when TabEnter was triggered, if I
remember correctly).  I rather not change it again, it might introduce
bugs.

-- 
DINGO:   And after the spanking ... the oral sex.
GALAHAD: Oh, dear! Well, I...
GIRLS:   The oral sex ...  The oral sex.
GALAHAD: Well, I suppose I could stay a BIT longer.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to