I recall (perhaps in the early 2000's) having set nocompatible
as the first line of my vimrc and most Vim guides and tutorials recommending that practice.
Some examples I could easily find online:
vimrc
file of Alex Quinn starts with:
set nocompatible " Use VIM settings rather than Vi settings; this *must* be
" first in .vimrc
- How I boosted my Vim blog article:
Before doing anything else, make sure you have the following line in your .vimrc file:
" This must be first, because it changes other options as side effect set nocompatible
However, that advice doesn't seem to make much sense these days, since nocompatible
is automatically used whenever a user .vimrc file is found, so there doesn't seem to be any compelling reason to use set nocompatible
in your user .vimrc file.
When was this practice necessary? Was the default to nocompatible when user vimrc is found changed in a specific version of Vim, such that setting nocompatible
was necessary in previous versions of Vim? Is there any advantages or side-effects of an explicit set nocompatible
that I'm perhaps missing?
While researching this subject, I found:
- References to this being necessary if you wanted to use that as a system vimrc. But that doesn't seem to be the case in most places, since the links above clearly talk about the user .vimrc file.
- Mentions of a specific Linux distribution (Debian) explicitly including a
set compatible
in the system vimrc file, which would require an explicitset nocompatible
to counter the distro defaults. (Not sure if that makes sense.)
Is there some truth or merits to these points above? Or was set nocompatible
in large part cargo culting?
options.txt
was added to git at 2004-06-13 (the 7th commit). It already describes thatcp
is off when avimrc
was found. That was v7.0001.set nocompatible
from my vimrc by this answer.