On Sun, 30 Apr 2006, Yakov Lerner wrote:

On 4/30/06, Gerald Lai <[EMAIL PROTECTED]> wrote:
On Sun, 30 Apr 2006, Yakov Lerner wrote:

> On 4/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>> > :help 'compatible'
>> >
>> > where (among other things) you can find the warning
>> >
>> > This is a special kind of option, because when it's set or reset, >> > other options are also changed as a side effect. CAREFUL: Setting
>> or
>> >       resetting this option can have a lot of unexpected effects:
>> Mappings
>> > are interpreted in another way, undo behaves differently, etc. If
>> you
>> > set this option in your vimrc file, you should probably put it at
>> the
>> >       very start.
>>
>> There is a remark about this right at ":help 'history'".
>
> Maybe behaviour of 'set nocp' can be differentiated depending on
> whether &cp was already off , or &cp was on. It's one thing if
> you do 'set nocp' and &cp was on, and another thing when
> you do 'set nocp' and &cp was already off. Maybe 'set nocp'
> doesn't need to reset options to default values when it was
> already 'nocp'.

But in Meino's case, it may have been that he was still in Vi compatible
mode when he set history.

Meino's commands were in .vimrc which means nocp was
already nocp.


True.

The 'compatible' option is one that clobbers settings, but for a good
reason. It determines whether Vim should work like Vi, or take on the
modern Vim capabilities. It's a big switch.

It's only a switch  if 'nocp' was off and becomes on. If option
X has value Y and I do 'set X=Y'  I expect it to be noop, except maybe
screen refresh. When option had different value, and I change it's
value, then I agree it's a switch.

That would be nice, but how about options like 'filetype', 'fileformat'
or 'background' that need to be "refreshed"? Or options like
'indentkeys' or 'listchars' that could be an out-of-order
comma-separated list composed of anything?

There's too much overhead of checking whether X=Y just to do a noop.

--
Gerald

Reply via email to