Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
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

3 Answers 3

up vote 4 down vote accepted

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.

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

share|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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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