Am 11.01.2012 17:40, schrieb Gary Johnson:
On 2012-01-11, Andy Wokula wrote:
Am 11.01.2012 02:56, schrieb Gary Johnson:
I started vim as

     vim -N -u NONE a

and executed

     :set tw?

I saw the result "textwidth=0" as expected.  Then I did the
following:

     :set tw=50
     :split b
     :set tw?
       textwidth=50

Again, as expected.

     :set tw=60
     :wincmd w
     :set tw?
       textwidth=50
     :split c
     :set tw?
       textwidth=60

I would have expected the 'textwidth' of buffer c to be 50, since
buffer a was the active buffer/window when ":split c" was executed.

Regards,
Gary

What matters for new buffers is the last change of the option's global
value.  In this case:  :set tw=60  in buffer b.

That's what I thought at first, too, but that's not what I
understand the documentation to say.

     :help tw

         'textwidth' 'tw'        number  (default 0)
                                 local to buffer

That doesn't say anything about a global value.

Here is a good description:
    :h local-options


     :help option-summary

         When creating a new window the option values from the
         currently active window are used as a default value for the
         window-specific options.  For the buffer-specific options
         this depends on the 's' and 'S' flags in the 'cpoptions'
         option.  If 's' is included (which is the default) the
         values for buffer options are copied from the currently
         active buffer when a buffer is first entered.  If 'S' is
         present the options are copied each time the buffer is
         entered, this is almost like having global options.  If 's'
         and 'S' are not present, the options are copied from the
         currently active buffer when the buffer is created.

I believe that the "currently active buffer" was 'a' when I executed
":split c".  'tw' in 'a' was 50 but 'tw' in 'c' was set to '60'.

Hehe, that paragraph is wrong and misleading, a left-over from Vim5.7!
I just tried it out, gVim5.7 behaves exactly as you say, with tw=50 in
the end.  At least the description for 's' "If 's' is included ..."
should be changed or removed.

Finally I found this (version6.txt): "Global option values introduced"
    :h new-global-values

--
Andy

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to