Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

would something like this not work?

curl http://url.to/vimrc | vim -u -



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.


"badness" of sharing a single login

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.


No, Vim doesn't support - as a file name to read from stdin for the -u option, just as the file to open for editing.


I admit to not trying it myself; simply formulating a possible Unix-y option. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: