On 19/06/08 17:48, Ben Fritz wrote:
> I'm puzzled by the following:
>
> gvim with gvim -N -u NONE
>
> :autocmd WinEnter * let test=test.'.'
>
> :let test=""
> :new
> :echo test
> :close
>
> :let test=""
> :copen
> :echo test
> :cclose
>
> :let test=""
> :pedit some_file.txt
> :echo test
> :pclose
>
> :let test=""
> :options
> :echo test
> :close
>
> The first two echos act as expected: test is set to a single dot
> character when opening a new window using :new or using :copen.
>
> The last two cases are interesting. Opening a single preview window
> apparently fires off _two_ WinEnter events. Opening an options window
> fires off a whole bunch of them.
>
> What's going on? Is this understood behavior, or is it a bug?

WinEnter is fired whenever a new window becomes active. Going to another 
window without opening anything -- such as by hitting Ctrl-W w -- fires 
it. You might want to check $VIMRUNTIME/optwin.vim for actions which 
open a window (:new, :split, :vsplit, ...), close a window (:q, :x, 
...), or somehow change the active window (:wincmd W, :wincmd w, windo, 
...).

If you want something which only fires when you _open_ a new window, try 
BufWinEnter and CmdWinEnter. Note that they won't be fired together, and 
that the former fires also when a window is renamed.


Best regards,
Tony.
-- 
A friend with weed is a friend indeed.

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

Raspunde prin e-mail lui