Tangling Dotfiles From an Org File

Despite the XDG base directory specification, configuration files are still stored all over our file systems. If you have a single machine, maintaining those files is not too much trouble—they’re almost all “set it and forget it”—but when you have multiple machines, especially if you frequently have to setup new machines, it can be a pain. A neat idea for dealing with this is to keep your dotfiles in an Org file and tangle them to their proper place. I wrote about that here and here.

The basic idea is that you put the contents of each config file into an Org source block and then tangle either a single block or all of them to write each config file to its proper place. That allows you to have a single source of truth for your dotfiles and makes setting up new machines—or even just updating a single config file—a snap.

NapoleonWils0n has an excellent video on implementing the idea. He used to keep all his dotfiles in a Git repository but that’s fairly difficult to set up and maintain. His Org based method handles both cases: it writes the dotfiles to their proper places but also builds a file for a Git repository. NapoleonWils0n doesn’t make clear the utility of maintaining a separate Git repository except to say it provides a further backup. Of course, you can put the Org file under version control and be done with it. Still, his process makes it clear how flexible the method is.

The video is 19 minutes, 23 seconds so plan accordingly. There’s a copy of the Org file he uses in his Github repository so don’t worry about trying to take in everything from the video.

This entry was posted in General and tagged , . Bookmark the permalink.