Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 5 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

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

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

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/tmp/git/environment/vim/ # install backs up the originals here
# For the loading of local files

And my .vimrc contains the following :

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

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](] 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .