Where are these non-default Vim settings stored if not in my .vimrc file?

3

1

So when I press :set I see a bunch of settings that are not on my ~/.vimrc file. (My guess is they're settings I've set years ago and don't remember).

So I do :version and get a path $VIM/vimrc, which is said to be "fall-back"ed by usr/share/vimrc. This is the "system vimrc".

I open the latter path, and the mystery settings are not in this vimrc file.

The only other path is the "user excrc file" at $HOME/.exrc, which I've no idea how to get to or what it is.

Anyone have any idea where the settings that show up when I command :set come from?

I'm on OS X (10.6).

iDontKnowBetter

Posted 2012-04-26T20:55:31.733

Reputation: 273

What settings do you see there? Maybe just overall defaults? (Note, not a vim expert here) – slhck – 2012-04-26T21:20:13.633

small stuff like background=dark, which looks like something I would've chosen. Language set to English... only it's not in the main vimrc fail, and according to UNIX for MAC OS X (tutorial I'm reading), the :set command should display all non-default settings currently on. -- I'd like to have them all in one handy .vimrc file. – iDontKnowBetter – 2012-04-26T21:24:22.213

Answers

5

There are a number of things Vim sets automatically if ~/.vimrc is present. Among them is 'nocompatible' which affects a number of other options. Additionally, Vim does try to detect the proper values for other settings based on the environment. For example, the proper value 'background' can often be auto-detected by Vim if invoked from an Xterm or compatible terminal emulator. The language settings will be based on your environmental variables.

Finally, you can run ":scriptnames" to see what files Vim has sourced since startup. This should include showing you where the system vimrc is located, if it exists.

Heptite

Posted 2012-04-26T20:55:31.733

Reputation: 16 267

Oh ok. That makes sense, because I'm using the "dark" preset in iTerm. – iDontKnowBetter – 2012-04-26T22:46:52.080

1

Try /etc/vimrc as this is the default for most Linux distros I've encountered and may also be the case for OS X.

Garrett

Posted 2012-04-26T20:55:31.733

Reputation: 4 039

doesn't look like there's a vim file in the OSX /etc/. – iDontKnowBetter – 2012-04-26T21:20:46.803

try /usr/share/vimrc – cam8001 – 2012-08-28T12:13:51.147

1

To see where a particular option was last set, execute

:verbose set <option>?

To see the options that vim sets by itself, start vim as

vim -N -u NONE

then execute :set. In my case, running Vim 7.3.487 on Linux, I see

:set
--- Options ---
  helplang=en         scroll=11           ttymouse=xterm2
noloadplugins         ttyfast
  fileencodings=ucs-bom,utf-8,default,latin1
  background=light

To find out why any of those are set that way, use :help. For example, :help 'ttyfast' explains that it is set because vim determinded that my terminal is an xterm.

garyjohn

Posted 2012-04-26T20:55:31.733

Reputation: 29 085