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 frequently move between accounts on my machine using SSH. Multiple different projects having their own development and production accounts. Is it possible to keep my vim environment the same between accounts?

I've tried playing with the VIMRUNTIME, VIM, and vimrc settings to define one shared location for the settings but that doesn't seem to work. The settings are sort of picked up but others are not. For example line numbers will be turned on, tabbing is enabled, key-bindings are there but the color scheme is not or the file-type doesn't seem to be properly detected for files.

share|improve this question
add comment

5 Answers

up vote 4 down vote accepted

Setting $VIMRUNTIME will override the loading of system-wide shared configuration, which is usually not what you want. And no, you can't specify more than one path in that environment variable, so it's not terribly useful (the docs hint that you shouldn't really be setting it directly, probably for that reason).

Instead, add to runtimepath from within your .vimrc:

set runtimepath+=/home/ACCOUNT/.vim

Then, use the environment variable VIMINIT to tell vim to source your (single shared) .vimrc on startup:

VIMINIT='so /home/ACCOUNT/.vimrc'

Now you'll have shared your .vimrc and your .vim directory and its contents, and you'll still have whatever system defaults are configured, which should be exactly what you need.

share|improve this answer
add comment

Instead of ssh'ing to another computer and starting vim why don't you open vim on your local computer and let vim edit the files over ssh?

share|improve this answer
    
Very interesting that it can do that, but in this particular case I need to be able to compile and deploy modifications. But I'll definitely keep it in mind. Neat! –  Danny Feb 6 '10 at 19:25
add comment

Well, what you need is not just the vimrc but all the subdirectories of vim : plugins, etc etc. The color scheme depends on a file, and the file-type recognition also depends on files. So you need a shared install of vim.

share|improve this answer
add comment

I love vim I love my bash environment I cry whenever I work on a machine without either... big crocodile tears

That being said, to resolve this I turned to GIT which, though not perfect for what I want, atleast allows me to keep my environments across hosts. ( On a side note, if anyone has a better alternative, please feal free ).

So using git I clone the repo to the remote machine and then launch my installer bash script.

My environment is as follows :

# For the loading of git files
# The deploy/install file will create the symlink ~/.vimrc > ~/git/.../vimrc
$HOME/git/environment/vim/etc/{colors,ftdetect,plugins,vimrc}
$HOME/git/environment/vim/deploy/{install,remove}
$HOME/tmp/git/environment/vim/ # install backs up the originals here
# For the loading of local files
$HOME/.vim/{colors,ftdetect,plugins,vimrc}

And my .vimrc contains the following :

set runtimepath=~/git/env/vim/etc,$VIMRUNTIME
share|improve this answer
add comment

thought there are ways to share the config locally as others described it still doesn't help you if you ssh out to another machine :).

What I do is I've setup a [github project](http://github.com/astrails/dotvim] with my .vim config and I just clone it everywhere.

I don't change my vim settings too often but when I do I commit and push it and a simple 'git pull' brings it up to date where needed.

share|improve this answer
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.