kota's memex

Stow deals with "packages," which are directories arranged like the ones in my dots folder from above (zsh, user-dirs, i3 are all stow "packages"). It has options for "installing," "removing," or "updating" these packages. Installing a package simply means creating a bunch of symlinks in a certain location that point to the corresponding files in the package. I think the easiest way to explain this is with an example.

This is how I install my i3 configs on a new computer.

cd ~/dots
stow -t /home/kota i3

The -t option tells stow which folder all the symlinks are relative towards, or rather, where to actually install the package. Basically, if running cp -r i3/* /home/kota/ would copy all the files to the correct location, then /home/kota is the correct directory for the -t option.

If you store you dots repo in your home directory, stow's defualt target directory is the parent which means you don't need the -t option.

stow defaults to creating symlinks, but if one or more of the directories exists it works around them. For example, if .config/i3 doesn't exist stow will make a symlink for that folder that points to the one in your i3 package. However, if that folder does exist, stow will create a symlink for .config/i3/config instead.

To uninstall use the option -D or sometimes you'll need to -R restow if you've added new files or want to prune old symlinks.

Once in a while you'll try to stow a config and you'll get an error informing you that you already have an i3 config in place and stow will give up instead of overwriting it. You can of course delete the config manually and try again or you can use the --adopt option.