Vim, its defaults, and the problem this presents sysadmins
One of Vim's many options is '
may be off or on. The real thing that it does, behind the thicket
of technical description, is that
hidden controls whether or not
you can casually move away from a modified Vim buffer to another
one. In most editors this isn't even an option and you always can
(you'll get prompted if you try to exit with unsaved changes). In
Vim, for historical reasons, this is an option and for further
historical reasons it defaults to 'off'.
(The historical reasons are that it wasn't an option in the original BSD
vi, which behaved as if
hidden was always off. Vim cares a fair bit
about compatibility back to historical vi.)
The default of
hidden being off gets in the way of doing certain
sorts of things in Vim, like making changes to multiple files at
once, and it's also at odds with what
I want and how I like to work in my editors. So the obvious thing
for me to do would be to add '
set hidden' to my
.vimrc and move
on. However, there is a problem with that, or rather two problems,
because I use Vim partly as a sysadmin's editor.
By that I mean that I use vi(m) from several different accounts
root account) and on many different machines, not
all of which have a shared home directory even for my own account
root always has a local home directory).
In order for '
set hidden' to be useful to me, it needs to be quite
pervasive; it needs to work pretty much everywhere I use vim. Otherwise
I will periodically trip over situations where it doesn't work, which
means that I'll always have to remember the workarounds (and ideally
practice them). As a non-default setting, this is at least difficult
(although not completely impossible, since we already have an install
framework that puts various things into place on all standard machines).
This is why what programs have as defaults matters a lot to sysadmins,
in a way that they don't to people who only use one or a few
environments on a regular basis. Defaults are all that we can count on
everywhere, and our lives are easier if we work within them (we have
less to remember, less to customize on as many systems as possible as
early as possible, and so on). My life would be a bit easier if Vim
had decided that its default was to have
PS: The other thing about defaults is that going with the defaults
is the course of least discussion in the case of setups used by
multiple people, which is an extremely common case for the
Sidebar: The practical flies in my nice theoretical entry
My entry is the theory, but once I actually looked at things it
turns out to be not so neat in practice. First off, my own personal
.vimrc turns out to already turn on
hidden, due to me following
the setup guide from Aristotle Pagaltzis' vim-buftabline package. Second, we already install
.vimrc in the root account in our standard Ubuntu
installs, and reading the comments in it makes it clear that I wrote
it. I could probably add '
set hidden' to this and re-deploy it
without any objections from my co-workers, and this would cover
almost all of the cases that matter to me in practice.
Comments on this page:Written on 04 October 2019.