On Jun 19, 12:23 pm, Tony Mechelynck <[EMAIL PROTECTED]>
wrote:
> 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.

So, I can kind of see why opening the preview window would fire off
two events...if it is implemented by opening the window, switching to
the window, and switching back.

The option window makes much more sense now, after looking at
optwin.vim. There are a _lot_ of "exe 'normal! <C-W>...'" commands in
there. Are there any plans to re-implement this using setwinvar,
settabwinvar, setbufvar, etc. instead? If not, is there some reason
not to do this, or has it just not been suggested yet?
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui