I need an example to differentiate the two events in Vim, as I'm having a hard time understanding them.
1 Answer
This difference is pretty obvious:
BufEnter X
:
- It was
bufnr() != X
- But now it becomes
bufnr() == X
BufWinEnter X
:
- It was
len(win_findbuf(X)) == 0
- But now it becomes
len(win_findbuf(X)) == 1
-
It's very clear now! I forgot the fact that a buffer in multiple windows! Thank you! Commented Dec 28, 2021 at 14:55
-
I would have written
empty(win_findbuf(X))
, but NBD.– D. Ben Knoble ♦Commented Dec 28, 2021 at 15:55 -
1@D.BenKnoble To me it rather clearly states "from zero to one". But de gustibus...– MattCommented Dec 28, 2021 at 16:13
-
Good answers are always worth reviewing. I just forgot about their difference... Commented Nov 30, 2022 at 17:40