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.

I share accounts with other developers for test environments. The .vimrc on some of these accounts sets rows and columns, changing my terminal size, which drives me nuts.

Is there a way I can set a temporary, "session-specific" .vimrc?

I imagine it being used like

% source ~acheong/.vimrc

and then all subsequent vim instances in that session using this personal .vimrc. (But of course, the above won't work.)

share|improve this question
    
I know it may not be worth the effort to convince your coworkers, but for what it's worth, .vimrc should never change the 'rows' or 'columns' options. It might be excusable in .gvimrc, though. –  Heptite Oct 19 '12 at 18:03
add comment

3 Answers

up vote 3 down vote accepted

You can start vim with a configuration file other than ~/.vimrc by using the -u option like this:

vim -N -u ~acheong/.vimrc

To avoid typing that each time, you could define an alias for it each time you log in to one of those accounts:

alias vim='vim -N -u ~acheong/.vimrc'

See

:help -u
:help initialization
share|improve this answer
    
Thank you, this is the complete answer that solved my issue. Also, I didn't know about the -N flag; useful. –  Andrew Cheong Oct 19 '12 at 14:40
add comment

Use the -u option to pass in a temporary .vimrc that will override the default. From the man:

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

i.e: vim -u ~acheong/myvimrc

share|improve this answer
add comment

Maybe are you searching for the so command ?

Moreover, how are you connecting to the shared session ? In case of a sudo, you can for instance use so ~$SUDO_USER/.vimrc.

share|improve this answer
    
This is possibly the most difficult command to Google, ever. My system doesn't have a command called so and I can't find any references to so online; could you elaborate? I'm using PuTTY/SSH and our standard shell is csh (and yes it makes me want to die). –  Andrew Cheong Oct 19 '12 at 14:32
add comment

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.