Maybe it's not a bug, but it bothers me a long time.
:set scrolloff=5 | setl scrolloff=0
:h
:setg so|se so|setl so
(global 5, local -1 as expected):b#
, first buffer is selected:setg so|se so|setl so
(global 5, local 0 as was set earlier for this buffer):b#
:setg so|se so|setl so
(global 5, local 0, not expected)When changing buffer to alternative help buffer it should have scrolloff set to global value.
9.1.377
OS: Debian 11
Terminal: Windows Terminal and tmux
$TERM: tmux-256color
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
This is a bit complicated. First of all, 'scrolloff' is a window-local option, not buffer-local. And when you do :h
you are opening a new window with the default values.
So let's go through your steps:
Set global scrolloff to 5, local to 0: :set scrolloff=5 | setl scrolloff=0
Set's the global/local window option scrolloff
Open any help: :h
Check current scrolloff in help: :setg so|se so|setl so (global 5, local -1 as expected)
opens a new window which is using the global scrolloff value as expected
Change buffer in a window with help: :b#, first buffer is selected
Check current scrolloff: :setg so|se so|setl so (global 5, local 0 as was set earlier for this buffer)
The current buffer is unloaded and a new buffer is loaded in this window.
Vim checks if this buffer is displayed in a different window. If it is, copies the window local options from that window to
the current window. So 'scrolloff' is now 0.
Change buffer back to help: :b#
Check current scrolloff: :setg so|se so|setl so (global 5, local 0, not expected)
Vim continues to use the local window-option value 0 in this case.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
When reading :h local-options
(the part where examples with list
option) I thought that even window-local options are also somehow copied to a buffer. For example when I create a new buffer in the window with local 'scrolloff=0' (:e 1234
) value is not stayed as is, it resets to global 'scrolloff=5'. After that I can switch between two buffers and scrolloff is changed accordingly. So what's the difference with help buffer than? E.g.
:e 1
(first buffer):setg so=5|setl so=0
:e 2
(second buffer, it's scrolloff is 5):b#
Even if I unload buffer 2, when I load it back it'll get scrolloff 5:
:b2
Input something in a buffer, save (:w
), then :bunload
.:b#
(scrolloff 0):b#
(loads buffer 2 back, it has global scrolloff 5)So I kind of don't understand what's so special with help buffer, that it doesn't behave like this.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.