Live data from Hacker News

A Way to Manage Dotfiles

github.com

41–44 of 44 posts

Re: A Way to Manage Dotfiles

#41
post #40

How do people manage the platform differences between Linux, macOS, Windows WSL, Windows Cygwin, Solaris (at one point I had it on my NAS); and environment differences, such as work machines vs home machines? I have my own dotfiles mechanism which splits out paths and configs by operating system, portable runtimes (e.g. Mono - may work on different OSes) and environments (enabling home and work configs to be stored i…

I stole this from somewhere, but in bash at least you can do something like this:

if [ $(uname) = "Darwin" ]; then ... # macos

if [ "$TERM" != "cygwin" ] ; then ... # cygwin

I'm sure there are other ways to determine WSL and others you mentioned.

Re: A Way to Manage Dotfiles

#42

I've had my dotfiles under version control for over a decade (hg for a couple years, then git). I've never used or felt the need for any special tools, and I don't use any extra symlinking. If you do that stuff, great, but here's what I do if you don't want to use any specialized tools: My home directory is just a git repo. There's a regular old ~/.git directory. All of the management I do is regular git stuff, like…

That's nice, until you accidentally type "git clean -fdx" into the wrong terminal and nuke your home directory. I would be way too scared to have all my files be untracked in an unclean repo.

I use `git clean` maybe once per year on average, so very low risk for me. And if that ever happens... that's why I have hourly backup snapshots! If I didn't trust my backups, I'd definitely address that before worrying about dotfile management. If you don't have a good safety net then you end up reinventing the net 100 times in other ways and everything gets more complicated.

Re: A Way to Manage Dotfiles

#43
post #40

How do people manage the platform differences between Linux, macOS, Windows WSL, Windows Cygwin, Solaris (at one point I had it on my NAS); and environment differences, such as work machines vs home machines? I have my own dotfiles mechanism which splits out paths and configs by operating system, portable runtimes (e.g. Mono - may work on different OSes) and environments (enabling home and work configs to be stored i…

I stole this from somewhere, but in bash at least you can do something like this: if [ $(uname) = "Darwin" ]; then ... # macos if [ "$TERM" != "cygwin" ] ; then ... # cygwin I'm sure there are other ways to determine WSL and others you mentioned.

Oh there are selectors you can run, but what of you want different config files? Different inputrc or dircolors because you use different terminals, etc. And then there's the difficulty in managing an enormous do-everything script, vs something which is compiled for the platform.
Post reply on HN