7

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.

5

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.

1

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.

0

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
0

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.

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.