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).

  • What settings do you see there? Maybe just overall defaults? (Note, not a vim expert here) – slhck Apr 26 '12 at 21:20
  • 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 Apr 26 '12 at 21:24

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.

| improve this answer | |
  • Oh ok. That makes sense, because I'm using the "dark" preset in iTerm. – iDontKnowBetter Apr 26 '12 at 22:46

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

| improve this answer | |
  • doesn't look like there's a vim file in the OSX /etc/. – iDontKnowBetter Apr 26 '12 at 21:20
  • try /usr/share/vimrc – cam8001 Aug 28 '12 at 12:13

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

--- Options ---
  helplang=en         scroll=11           ttymouse=xterm2
noloadplugins         ttyfast

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.