- Perl is required, but should be installed by default on most UNIX systems.
- On Mac, you can
brew install thezeroalpha/formulae/conf. Alternatively, or on Linux, you canmake install. The third option is to download theconfscript, make it executable, and put it in your$PATH. - Set the value of the
DOTFILESvariable to the location of your dotfiles, either in the environment (recommended), or in theconfscript itself. - Set up your dotfiles hierarchy in any way you want, see the FAQ below for an example.
- Create a map file; this file defines how your dotfiles/folders map to other locations in your filesystem.
You have three options, in ascending order of customization:
- Run
conf editto open the default file at the default location (nameddot.mapat the root of the directory in theDOTFILESvariable). - Or manually put a map file in the root of the directory defined in the
DOTFILESvariable. By default, the file is named "dot.map", but this can be changed by manually editing the definition of$MAPFILEin theconfscript. - Or put the file wherever you want on your filesystem, and change the definition of
$MAPFILEin theconfscript accordingly.
- Run
- Use
conf, and profit, maybe. Runconf -horconf -manto get help.
This is easier by example.
If you have a dotfile directory hierarchy that looks like this:
~/dotfiles
├── dot.map
├── shell
│ ├── zprofile
│ └── zshrc
└── vim
│ ├── after
│ │ └── ftplugin
│ ├── autoload
│ └── vimrc
└── tools
├── lfrc
└── polybar
└── config
Then the dot.map file listed in the dotfiles directory might look like this:
shell:
- zprofile: ~/.zprofile
- zshrc: ~/.zshrc
vim:
- after/ftplugin: ~/.vim/after/ftplugin
- autoload: ~/.vim/autoload
- vimrc: ~/.vimrc
tools/lfrc: ~/.config/lf/lfrc
tools:
- polybar:
-- config: ~/.config/polybar/config
Lines starting with '#' are comments, all other lines are interpreted. All file/directory names are relative to the value of the DOTFILES variable, which is set in the environment or explicitly inside the conf script itself.
As long as the DOTFILES variable is set to ~/dotfiles, running conf link would result in the following symbolic links:
~/.zprofilepointing to~/dotfiles/shell/zprofile~/.zshrcpointing to~/dotfiles/shell/zshrc~/.vim/after/ftpluginpointing to~/dotfiles/vim/after/ftplugin~/.vim/autoloadpointing to~/dotfiles/vim/autoload~/.vimrcpointing to~/dotfiles/vimrc~/.config/lf/lfrcpointing to~/dotfiles/tools/lfrc~/.config/polybar/configpointing to~/dotfiles/tools/polybar/config
Valid question, there's so many dotfile managers already available. Why do I think I'm so special that none of the existing ones are good enough?
Well, a few points about this manager:
- It manages your dotfiles, and does nothing else. It doesn't have git integration, it doesn't do any smart tracking, it doesn't replace your toilet paper -- it just manages symbolic links between your configuration and the various configuration directories around your filesystem. You want git actions? Use git.
- It reads its configuration from a single, plain-text file that can be named whatever you want.
- It uses a configuration syntax that's intuitive for me.
- It leverages the filesystem structure and environment variables for a simpler configuration.
- It essentially runs anywhere out of the box, as its only dependency is on Perl 5, which is generally available on almost any (modern) UNIX system.
All this to make a dotfiles manager that works exactly the way I want it to work.
Because:
- It's basically ubiquitous.
- It's a step up from shell script in data structures, readability, maintainability, abstractions, etc.
- It's still low level enough to work with the shell and filesystem, unlike e.g. Python.
If I want to test for a file's existence, I can use
-e, like in Bash. Symlink functions are available without having to import anything. - It's powerful for text manipulation, because it has regex built straight into the language, among other things.
- It's still quite fast. In fact, it's super fast, compared to my previous version written in Bash. On my computer, the "list all" operation is at least five times faster, and "check all" is at least seven times faster.