On Tue, Jul 14, 2009 at 4:39 PM, Roman Khlystik wrote:
>
> Hi guys!
> I trying write script which will be react to switching between
> buffers.
> Code from my config file:
>
> augroup testgroup
>    au!
>    au BufEnter * echo 'bufenter'
>    au BufLeave * echo 'bufleave'
> augroup END
>
> When I open two files:
> # vim bla.cpp main.c
> and then execute :bnext I'll be seen two string 'bufenter' and
> 'bufleave' all the time while executing :bnext.
> If I comment line
>  "au BufLeave * echo 'bufleave'
> and then repeat procedure I'll be seen string 'bufenter' just one time
> after first command :bnext.
> I do not understand why BufEnter event not correctly triggered without
> BufLeave event.
> Please, give my some hints.

I bet it is retriggered, and the screen is just being redrawn after
the BufEnter so that you don't wind up seeing the echoed text.  With
two things having been printed, vim will wait for you to press a key
before it does the redraw.  Try switching from :echo to :echomsg, or
printing two lines in each event, and I bet you'll see that it is
being executed.

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to