-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinLeave and WinEnter point at the same buffer on tabnew #29430
Comments
@zeertzjq is that trully a documentation issue, or something that does not work as indended ? Seems inconsistent, as WinEnter and Leave are triggered, and produce correct results, if you navigate to already existing tab. |
Yes. "before the file is loaded" means before the buffer is created. |
I see, then in case one would like to cover the true WinEnter use case, one has to use |
does vim really differ here? |
@justinmk, edited the issue, vim behaves the same. |
Internally
The first command triggers winleave/winenter with old buffer active; then the second one does bufleave/bufenter for a new buffer. This is how virtually all "-new" commands work in Vim. Btw. There is no such thing as "true winenter". If the current window is changed (for whatever reason) then winleave/winenter is triggered. Events are never about commands used, they are about "state changes". |
Problem
Having registered the following autocmd
BufLeave and BufEnter work as expected, however WinLeave and WinEnter do not. Win* events point to the same buffer (from the first tab). Buf* events point at the old and then the new one, as expected.
Both events point at the same buffer, the docs are somewhat unclear, as there is a note pertaining to file but nothing is mentioned what goes on when a new buffer is created as a consequence of tabnew.
Steps to reproduce
See above
Expected behavior
WinEnter should point to the buf in the new tab not the old one. The way BufEnter points to the buffer we enter, in the new tab, and BufLeave points to the buffer we left in the prev tab
Neovim version (nvim -v)
0.10.0
Vim (not Nvim) behaves the same?
yes
Operating system/version
ubuntu 22
Terminal name/version
alacritty
$TERM environment variable
alacritty
Installation
github
The text was updated successfully, but these errors were encountered: