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.

On my Linux server at work, the admins did not install cscope, and I installed it from source in my home directory and added it to the $PATH. The trouble is, the /etc/vimrc has a reference to /usr/bin/cscope which does not exist and everytime I start vim, it complains about that and I have to press for that message to go away.

It is interesting that if I remove cscope from my $PATH, I don't get that behavior - so it is possible that vim is testing that cscope exists somewhere, and only then executing the cscope configuration - but then it gets it wrong!

So my question is: can I set something up in my .vimrc so it does not source the global /etc/vimrc? I don't want to move cscope out of PATH, as I don't want to type the full directory name every time I run it from the command line.

share|improve this question

2 Answers 2

up vote 39 down vote accepted

From the Vim man page:

-u {vimrc}

Use the commands in the file {vimrc} for initializations. All the other
initializations are skipped. Use this to edit a special kind of files.
It can also be used to skip all initializations by giving the name "NONE".
See ":help initialization" within vim for more details.

If you still want your ~/.vimrc to be processed, try this:

vim -u ~/.vimrc

Add the following line to ~/.bashrc (or your shell's equivalent file if not bash) to have the -u switch added automatically:

alias vim="vim -u ~/.vimrc"

You won't be able to add something to ~/.vimrc to prevent /etc/vimrc from being read, because the system file is processed before your user file (see ":help init", section 3, "Execute Ex commands, from environment variables and/or files").

share|improve this answer
    
Thanks! This finally allowed me to edit a file that (for some reason) had thousands of characters in one line and would otherwise freeze my Vim for ever. –  Hubro Feb 6 at 11:48

From the Vim man page:

-u {vimrc}

Use the commands in the file {vimrc} for initializations. All the other initializations are skipped. Use this to edit a special kind of files. It can also be used to skip all initial- izations by giving the name "NONE". See ":help initialization" within vim for more details.

So this should do the job:

vim -u NONE

You should be able to alias this to your normal command for everyday usage.

share|improve this answer
    
... but I want ~/.vimrc to execute, just not /etc/vimrc –  florin May 13 '10 at 21:40
2  
vim -u ~/.vimrc –  heavyd May 13 '10 at 22:08
4  
The NONE flag was very handy, thanks! –  Niels Bom May 10 '12 at 12:02

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.