3

Checking the man page for vim says it's -u switch that lets me choose a different vimrc file

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

But, i would like to retain the default configurations and just add few more setting from my user-vimrc file. Command i use is

$ vim -u user.vimrc *file-to-edit*

Any way to achieve this?

To be more specific of what I am losing with current behaviour:

Without my vimrc, I get a default colorscheme and when i give my user.vimrc, the colorscheme is being switched off. I am not able to track how to set the colorscheme which is given by default. There is no default .vimrc.

Note: I am on a shared env, so i don't want to create a .vimrc. I will just source my vimrc which will be available only for me.

1

The .vimrc is just a Vimscript file like any other. You can source it via

$ vim --cmd "source path/to/user.vimrc" *file-to-edit*

With this, it will come first. There's also the -S {file} command-line argument, which would source it at the end (which makes this unsuitable for plugin initializations, but would work if you just have some mappings and settings).

  • Perfect. Have aliased vim to vim -S user.vim for my session on the shared host :) – mtk Jan 15 '15 at 10:40
0

Your user.vimrc may have options to reset the existing color scheme or the user.vimrc colorscheme is based on a colorscheme which may not be existing in that system. You could share your user.vimrc for others to check.

Look for keywords like NONE, reset and clear in the user.vimrc and make sure that they are not turning off the entire colorscheme.

  • No setting of colorscheme, just indent and format on save options present in my user.vimrc, total 6 lines.. that's it – mtk Jan 15 '15 at 10:42
0

You probably just need to add a line to your user.vimrc file:

source /etc/vim/vimrc

This will pull in the default initial config, at least on Debian systems; on Red Hat systems the file is probably /etc/vimrc.

  • I am on RH 5.3, and don't see the file you mentioned in /etc – mtk Jan 15 '15 at 10:43
  • 1
    If you run vim -V it will dump a trace of everything it looks for and sources. On my RH 5.10 system it begins with sourcing "/etc/vimrc" – wurtel Jan 15 '15 at 13:07
  • I misread, The command output shows the file being sourced which is /etc/vimrc. – mtk Jan 19 '15 at 8:14
0

You can source the default .vimrc: so .vimrc in your user.vimrc and all the settings including colorsheme should appear..

  • I have mentioned it in my question. I don't have a .vimrc file and also don't/can't create it. It's a shared host – mtk Jan 15 '15 at 10:44

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.