Home » Questions » Computers [ Ask a new question ]

How could I keep my vim environment when ssh-ing between accounts on the same machine?

How could I keep my vim environment when ssh-ing between accounts on the same machine?

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?

Asked by: Guest | Views: 200
Total answers/comments: 2
bert [Entry]

"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."
bert [Entry]

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