I don't understand the purpose of options that are "local to a window", such as for example colorcolumn
and how they behave.
This is a sequence to demonstrate what I mean:
I start gvim. An empty, unnamed buffer appears.
I open an inexsting file without a file type associated with it:
:e c:\temp\abc.foo
write some text and set colorcolumn to 1
:set cc=1
and write the buffer to disk
:w
I split the window
:split
and edit another inexsting file
:e c:\temp\def.foo
When writing some text, I see that the color column is set to 1. Which is what I expected, since vim copies the value from the currently active buffer.
I set the color column to 2
:set cc=2
and write this buffer
:w
and start to edit yet another new file
:e c:\temp\ghi.foo
Again, the color column option value is copied from the currently active windows and set to 2
. This is still what I expected.
I switch the buffer to the buffer below <Ctrl-W>+j
so that I am in c:\temp\abc.foo
, the color column option value of which is 1
.
I start editing def.foo
in that window:
:bu def.foo
Now, the color column option value is 2
, which I have previously set for that buffer, but not for that window. Here, I'd have expected the value to be 1
because it is an option "local to a window".
Can someone explain the rational of this behavior?