Posted by sdovan1 2 days ago
Supported: .profile, .vimrc, .bashrc, .tmux.conf, etc.
This idea comes from kyrat[1]; passing files via a base64 string is a really cool approach.
scp my-precious-dotfiles remote:~
trap 'ssh remote rm my-precious-dotfiles' EXIT
ssh remote
Or you can even bake the trap into the remote bash's invocation, although that'd be a bit harder.You can also just place config files anywhere if you know what you then load. That's what I do in my dotfiles, but not exactly like the parent. I also purposefully keep the repo size tiny so it's also just easy to clone. I'd recommend setting a env var so you can always just set that
Also don't forget you can have local vim files. I have a function at the end of my vimrc that looks for '.exrc', '.vim.local', '.nvim.local' in the current directory. Helpful for setting project settings.
Edit: just remembered there was a good comparison of lnk and stow on the HN discussion of lnk from a few months back [1].
Keep the alternate sets in different subdirectories.
Wouldn't it make more sense to have a tool that brings files over to the local computer, starts Vim on them, and then copies them back?
I had to laugh out loud. I couldn't imagine such a system, that wouldn't be POSIX compliant. So I looked it up, and indeed, it's entirely possible. Debian doesn't necessarily include it.
I've been on a lot of systems and can't remember a single instance of not having vi (though I do vim). So pretty rare, like you said
I'd hate to jump to conclusions, but what username are you looking into what machines with for that to be an issue?
It has an activate script which sets PATH, XDG_CONFIG_HOME, XDG_DATA_HOME, and friends. This way everything runs out of that single dir and doesn’t pollute the remote.
My ssh RemoteCommand then just checks for and calls the activate script if it exists. I get dropped into a nice shell with all my config and tools wherever I go, without disturbing others’ configs or system packages.
One of the engineers wrote a shell alias called “shitssh”, which would call ssh with the right options to allow the old crufty crypto algorithms to be used. This alias got passed down to new members of the team like a family heirloom.
I hate network vendors. Wish I could put BSD on my old Catalysts.
tmp="$(mktemp -d)" && rsync -a --exclude='.ssh' user@host:~/.[!.]* "$tmp"/ && HOME="$tmp" exec "$SHELL"Reason I say would be is that I disable disk cache among other things performed by Arkenfox [1]
Exactly why I apply Sun Tzu methodology.
¯\_(ツ)_/¯
It's surprising to me how many projects can be replaced with just a line or two of shell script. This project is a slightly more sophisticated shell script that exposes a friendlier UI, but I don't see why it's needed when the alternative is much simpler, considering the target audience.
git clone $uri dotfiles; export HOME=$(pwd)/dotfiles
These days, my laptop acts as a dumb SSH gateway for Linux VMs. No configuration or setup, aside from VS code connecting to VMs. Any server that I would want to load my dotfiles onto will almost always have git installed.Rant (not directed at any comment here): If it's a production server without git, then please do not run scripts like this. Do not create junk directories on (or ideally any modifications to) secure machines. It inevitably causes new and uninteresting puzzles for your colleagues. Create documented workflows for incident responses or inspection.
On the other hand, if the remote machine is mine, it will have my config anyway.
$ tar cf - ~/.shrc | ssh target '(cd ~ && tar xf -)'On that note, I didn't see any mention of https://github.com/romkatv/zsh4humans/blob/master/tips.md#ex... , so there.
That said, for personal servers this is brilliant. I've been using a git repo for dotfiles but having them automatically cleanup on disconnect is clever.
One improvement: consider using SSH's ProxyCommand or LocalCommand instead of wrapping SSH entirely. That way it works transparently with tools that call SSH directly (git, rsync, etc).
Also curious - does this handle tmux sessions properly? I often SSH in, start tmux, disconnect, then reconnect later. Would the dotfiles still be there?