Why change the defaults ?

54 views
Skip to first unread message

Tony Mechelynck

unread,
Dec 1, 2024, 3:04:34 PM12/1/24
to vim-dev, vim_use
I see several threads aguing in favour of a change of Vim's defaults.
I believe that such changes are unwise, and here is why :

At the moment, there are several sets of "default" option settings in Vim :
- "compatible" defaults (or "vi defaults") used when the -C switch
is used on the command-line or when you have no vimrc but an exrc
- - These are there to mimic the behaviour of legacy Vi (with the
exception of what Bram regarded as "bugs" in the POSIX description of
Vim). Therefore IMHO they MUST NOT be changed ;
- "POSIX" defaults, used in addition to the "vi defaults" when
$VIM_POSIX is set. These try to make Vim even more like legacy Vi than
just setting 'compatible', even to the point of imitating its
POSIX-entrenched "bugs". For the same reason as above, IMHO they MUST
NOT be changed ;
- "nocompatible" defaults. They are used, for example, if you have
an empty vimrc, or if you put -N -u NONE on the command-line ;
- "defaults.vim" settings. These are set by $VIMRUNTIME/defaults.vim
when no vimrc is found.
- - They are also set if you source either defaults.vim or
vimrc_example.vim somewhere near the beginning of your vimrc, or if
you have -u DEFAULTS on the command-line even if you have a vimrc
(which in that case won't be sourced).

I see several threads proposing to make this or that "defaults.vim"
setting the Vim default for everybody. IMHO this is unwise, because it
is not backward-compatible. If you want those settings even though you
have a vimrc, source the defaults.vim or the vimrc_example.vim from
it. If there are _other_ settings set by the defaults.vim which you
_don't_ want, well, reverse them when Vim comes back to your vimrc
after sourcing them. This is the time-honored backward-compatible way
to do it and if you do it this way instead of changing everyone's
defaults, no one will be surprised.

For instance the defaults.vim contains a line which says
filetype plugin indent on
My preferences go to filetype detection on, filetype plugins on,
filetype indent off. No problem : after sourcing
$VIMRUNTIME/vimrc_example.vim (which calls the defaults.vim nowadays)
my vimrc has a line
filetype indent off
and voilà.

Best regards,
Tony.

Steve Litt

unread,
Dec 1, 2024, 3:23:11 PM12/1/24
to vim...@googlegroups.com
Tony Mechelynck said on Sun, 1 Dec 2024 21:04:09 +0100

>I see several threads aguing in favour of a change of Vim's defaults.
>I believe that such changes are unwise, and here is why :

I agree for an additional reason: Software should be changed only when
there's a compelling reason to change it. Anything less than compelling
is just churn.

>
>I see several threads proposing to make this or that "defaults.vim"
>setting the Vim default for everybody. IMHO this is unwise, because it
>is not backward-compatible. If you want those settings even though you
>have a vimrc, source the defaults.vim or the vimrc_example.vim from
>it. If there are _other_ settings set by the defaults.vim which you
>_don't_ want, well, reverse them when Vim comes back to your vimrc
>after sourcing them. This is the time-honored backward-compatible way
>to do it and if you do it this way instead of changing everyone's
>defaults, no one will be surprised.

The preceding paragraph is obviously the best way to satisfy everyone.
Those who are satisfied with the way things are now keep using Vim as
always. Those who want to adopt the new defaults in-toto source
defaults.vim. Those who want to make their own Vim interface source
something like my_defaults.vim.

SteveT

Steve Litt

http://444domains.com

Christian Brabandt

unread,
Dec 2, 2024, 11:19:27 AM12/2/24
to vim...@googlegroups.com, vim-dev
Hi,
As far as what I am concerned, I don't plan to make changes to the
defaults, except for gradually moving (non-controversial) defaults from
defaults.vim to the C code, because this seemed to be what Bram wanted
to achieve. But it still causes a bit of discussion.

Independently of this, there has been a bit of discussion on whether or
not we should handle defaults.vim a bit more consistently, such that
there is no inconsistency between:
- users not having a configuration file at all
- users creating a simple (empty) vimrc file (where suddenly Vim would
behave slightly differently)

This has been a major source of discussion/confusion/hate for people in
the past. I don't know how to improve this situation yet.

Thanks,
Christian
--
Here I am in the POSTERIOR OLFACTORY LOBULE but I don't see CARL SAGAN
anywhere!!
Reply all
Reply to author
Forward
0 new messages