This what is logged in :messages
when I'm printing the value of nu
and rnu
upon the 4 events WinLeave
, WinEnter
, BufLeave
, BufEnter
during the action, done twice, of opening :help
and closing it. The erroenous command fffffff...
was the fastest way make a visual separation between the 4 actions (:h
, :q
, :h
, :q
).
"relativenumber.vim" 9L, 468B
WinLeave relativenumber.vim (nu = 1, rnu = 1)
WinEnter relativenumber.vim (nu = 1, rnu = 1)
BufLeave relativenumber.vim (nu = 1, rnu = 1)
BufEnter (nu = 0, rnu = 0)
"help.txt" [readonly] 253L, 9491B
BufEnter /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
E492: Not an editor command: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
BufLeave /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
WinLeave /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
WinEnter relativenumber.vim (nu = 1, rnu = 1)
BufEnter relativenumber.vim (nu = 1, rnu = 1)
E492: Not an editor command: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
WinLeave relativenumber.vim (nu = 1, rnu = 1)
WinEnter relativenumber.vim (nu = 1, rnu = 1)
BufLeave relativenumber.vim (nu = 1, rnu = 1)
BufEnter (nu = 0, rnu = 0)
BufLeave (nu = 0, rnu = 0)
"help.txt" [readonly] 253L, 9491B
BufEnter /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
E492: Not an editor command: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
BufLeave /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
WinLeave /usr/share/vim/vim90/doc/help.txt (nu = 0, rnu = 0)
WinEnter relativenumber.vim (nu = 1, rnu = 1)
BufEnter relativenumber.vim (nu = 1, rnu = 1)
I don't understand a few things:
- Why do the first time I do
:h
and the second time generate different output? - Why the sequence of events upon
:h
isWinLeave
->WinEnter
->BufLeave
->BufEnter
? - Why upon
:h
I see thatWinEnter relativenumber.vim (nu = 1, rnu = 1)
, consideringnu
andrnu
are both off in:h
elp? - Why is there a buffer with no name, in the games?
The file I sourced before doing the 4 actions is the following
set nu
set rnu
augroup RelativeNumberOnlyInCurrentBuffer
autocmd!
autocmd BufEnter * echom 'BufEnter ' . expand('%') . ' (nu = ' . &nu . ', rnu = ' . &rnu . ')'
autocmd BufLeave * echom 'BufLeave ' . expand('%') . ' (nu = ' . &nu . ', rnu = ' . &rnu . ')'
autocmd WinEnter * echom 'WinEnter ' . expand('%') . ' (nu = ' . &nu . ', rnu = ' . &rnu . ')'
autocmd WinLeave * echom 'WinLeave ' . expand('%') . ' (nu = ' . &nu . ', rnu = ' . &rnu . ')'
augroup END