Yegappan Lakshmanan wrote:
> The BufWinEnter autocmd is not invoked when splitting a window.
> According to the help for the BufWinEnter autocmd, this autocmd
> is invoked when a buffer is displayed in a window.
>
> For example, use the following autocmd:
>
> au BufWinEnter * echomsg "Entering buffer " . expand("<afile>")
>
> With the above autocmd, if you execute the following commands:
>
> :e <somefile>
> :split
>
> The BufWinEnter autocmd is not invoked for the new window.
The BufWinEnter event is normally used to set window-local options for
the file being edited. When you split a window you get all the option
settings from the existing window. Thus it's really a split, you don't
get another buffer in a window.
> But if you use the following commands, then the BufWinEnter autocmd
> is invoked:
>
> :e <somefile>
> :split <somefile>
Vim doesn't check if the filename argument of :split happens to be the
same as what is already being edited, thus it assumes it is another
file and BufWinEnter is triggered. The file is reloaded too.
--
TALL KNIGHT: We shall say Ni! again to you if you do not appease us.
ARTHUR: All right! What do you want?
TALL KNIGHT: We want ... a shrubbery!
"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 ///