Am 13.01.2012 22:42, schrieb Bram Moolenaar:

Andy Wokula wrote:

I think I just found a minor bug in the help:

      :h :setl|/^:se\[t].*}<
,----
| :se[t] {option}<
|     Set the local value of {option} to its global value by
|     making it empty.  Only makes sense for |global-local|
|     options.
`----

The command should be :setlocal, not :set.  The example under
*global-local* is ok.

Ok, the last statements weren't right.  But I still think there are
"global-local" issues in the help and in Vim that should be fixed.  Yet
it's all a special case as namely 'autoread' is the only global-local
boolean option so far.

Using
    :set ar<
*is* ok to make the local value undefined.  Suggesting :setlocal was
a mistake, because
    :setlocal ar<
is supposed to copy the global value to the local value (possibly
creating the local value).  The latter works according to buffer-local
options.

Problem: Both commands actually work different at the moment, :set ar<
does what  :setlocal ar<  is supposed to do and vice versa.

Thus the example under  :h global-local  is not ok:
,----
| You can switch back to using the global value by making the local
| value empty: >
|         :setlocal makeprg=
| This only works for a string option.  For a boolean option you need to
| use the "<" flag, like this: >
|         :setlocal autoread<
`----
    :setlocal makeprg=
indeed works, but it's only a trick.  The correct command is
    :set makeprg<

IMHO it's not written in stone that the empty string value means the
same as "undefined" (for the local value of global-local string
options).  E.g. for 'stl', one might want to use the empty string to get
the default statusline only for the current window:
    :setlocal stl=

So I'd say it was a design-error to make
    :setlocal ar<
work in analogy to
    :setlocal makeprg=
(because there is no analogy)

Example to show the difference:

Bad:
      :setl ar&
      :set ar<  ar?
      noautoread

Good:
      :setl ar&
      :setl ar<  ar?
      --autoread

New intention (examples how it should work):

    " set local value to global default:
    :setl ar& ar?
    noautoread

    " remove the local value:
    :set ar<
    :setl ar?
    --autoread

    " copy global value to local value:
    :setl ar< ar?
    noautoread

Either the help is wrong or  :set ar<   should actually remove the
local value.

The help for :set is ok and  :set ar<  should remove the local value.

The help is correct.  When you do ":set path<" it copies the global
value to the global value and makes the local value empty.  Thus the
local value then follows the global value.

Makes sense for string options, ok!  Yeah, I got really confused.
(just not sure what "it copies the global value to the global value"
means to the user)

I can see why you are confused.  This text should be better:


:se[t] {option}<      For |global-local| options: Remove the local value of
                      {option}, so that the global value will be used.
                      {not in Vi}

This is slightly better, ok.

In short:
- implementation of 'autoread' should be changed
- under  :h global-local , don't suggest to use  :setl makeprg= ,
  instead suggest  :set makeprg<
- (maybe) rather not use the empty string for "undefined"

--
Andy

--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui