I have a much more interesting problem (I think!).
I wish Vim could read its configuration from a HTTP-URL passed in an environment-variable:
REMOTE_DOTVIM=https://foobar.com/dotvim
I'm dealing with many dozens of hosts and getting my precious dotvim onto all of them is outright impossible. Especially on accounts shared with other people.
There are hacks around it, but they are nasty (pasting a script, aliasing stunts).
I realize the chances for actually getting this feature are rather slim. But gosh would it make my day...
Plain curl unfortunately doesn't cut it because that misses .vim, which contains all the goods (plugins etc.).
But yes, in essence that's what I'm doing right now, just instead of curl I rsync the entire dotvim and then run 'vim -u' (plus a few other vars).
It gets the job done (usually), but it's an extra-hoop that I wish I wouldn't have to take. More than once I've had the alias that I setup with the pastie fail for one reason or another, which then sets me back a couple minutes, torn between fixing it yet again or just moving on with plain vim.
I use a dotfiles repository on Github to easily get my Vim environment set up on a new machine.
You mentioned the notion of shared machines; I'm resisting the urge to go on a rant about the inherent "badness" of sharing a single login across multiple people in what is a multi-user environment. The whole point of a user account is to be able to set things up the way you want them.
That's the age-old discussion about to what degree one should sanction user-logins to production-hosts and whether permission/sudo-hell is preferable over the alternative.
It doesn't quite belong here so let's just assume the classic case of "bootstrap gone awry" where you're left with root, vanilla vim, and a semi-rational desire to have your fancy syntax-highlighting while you fix up that partition table. ;)
Apart from the obvious snide answer: "You shouldn't share accounts, use sudo." -- I see what you mean.
I think I would've solved this by (somewhat similar to sudo in some respects) setting VIM to point to your home (this might mess up ownership of some files, though) (see :help $VIM). You could set this in .bashrc (I think) - or your vimrc file that you can get from an url. It would require you to have access to your files, either way of course.
If the main use case is "just" root, maybe have something in roots .bashrc that sets up /home/root/<normal user name> and maps $HOME there? You'd have to be a bit careful setting it up to create that structure if it was missing, better to make sure all hosts have it by default... you'd still need to map your username for your root-session...
(If you can use sudo, then see sudo(1) and $SUDO_UID and $SUDO_USER -- you could have .bashrc map HOME to /home/${SUDO_USER}/.root for example?).
Sorry if this comment is unclear -- I'm not entirely sure what problem you're really trying to solve here.
This works to a degree but misses all the plugins, thus currently I'm using rsync - basically pasting a giant blob that turns 'vim' into an alias that first rsyncs and then runs 'vim -u'.
The point is that I have to remember pasting that blob, sometimes the blob fails, etc.
I'll be the first to admit that this is pretty much a Maserati-Problem. Still, keeps crossing my mind...
I think it's an interesting problem, indeed. I've been blessed enough to only have a few machines (<10) under my current care, and I've used the github variant mentioned above on all of them.
How many plugins are you using? Maybe you could make a vimrc.portable that contains the basic stuff that you need, but isn't the complete setup. I know I don't need all the 40-ish plugins I have in my full setup when I'm just doing sysadmin stuff.
You deal with dozens of hosts and do not have any way to distribute a file to all of them? Does that imply that you are doing all management of these hosts and their files individually, by hand?
No, it implies that most of the accounts where it is an issue (i.e. root and the app-account) are used by multiple people with potentially conflicting vim-preferences. There are elaborate hacks around that (i.e. identifying users by their ssh-keys) and we actually have one deployed for the app-account. But there are various scenarios where that occasionally fails (e.g. hopping through a bastion host).
And more generally this is an instance of bootstrap-dilemma: When are you most likely to ssh into a host directly? When something is wrong with that host, presumably with the automated bootstrap. :)
I see, the account sharing rules out the ordinary way of supporting multiple users.
So I think the problem has broader scope than vim. If you want separate configs for anything (not just vim but your shell, etc.) then you will need some slightly clumsy indirection. One idea: the shared account has a script or alias for specifying which personality of config you want. './cfg moe' could set CFG=~/.cfg_moe, wget it from http://internalhost/moe if it doesn't already exist, and alias vim to vim -u "${CFG}/.vimrc". Is that a possibility?
If you can't have even a shared script then we are talking about pasting in a URL every time, in which case you can also paste in some awkward snippet...
to mount a dotfiles or .vim directory via sshfs...
to check out/cache your config locally (into .cfg_moe or something) and then run vim -u to pick it up;
or vim -c with something to source a remote vimrc file every time.
However, without knowing about your environment, I am skeptical that very many bootstrap failures will result in a condition where you have a functioning system with thousands of files already, can't scp anything in, but can ssh in. And in those rare conditions it seems to me less of a big deal not to have all the config, it just makes it important to be able to function without it every now and then.
I wish Vim could read its configuration from a HTTP-URL passed in an environment-variable:
I'm dealing with many dozens of hosts and getting my precious dotvim onto all of them is outright impossible. Especially on accounts shared with other people.There are hacks around it, but they are nasty (pasting a script, aliasing stunts).
I realize the chances for actually getting this feature are rather slim. But gosh would it make my day...