-
Notifications
You must be signed in to change notification settings - Fork 199
Full Documentation
Besides the README.md and .gitignore, there are four files/directories in the base branch.
-
bin/dfm- The main utility for managing (installing/updating/uploading) dotfiles. -
.dfminstall- This is a config file for whendfm installis run. -
.bashrc.load- This file is the bootstrap file for loading any shell customizations. The default only makes sure$HOME/binis in the path so thatdfmcan be run easily. This file is loaded becausedfmputs the following line at the end of.bashrcon install:. $HOME/.bashrc.load -
t- Tests for thedfmutility.
dfm stands for Dot File Manager. The name was chosen because the best commands (like svn or git) are only three characters.
Running dfm is like running git. There are subcommands, like install and updates that perform different functions. Each subcommand has it's own set of options and there are also options that apply to all subcommands.
The main reason for dfm to exist is to install dotfiles. This is done with the install subcommand. Running dfm install will go through all the files and directories in the repository and install them in $HOME using symlinks.
You can control what files are skipped by adding .dfminstall files in your repository. For instance, the default .dfminstall file has the following contents:
README.md skip
CHANGELOG.md skip
t skipMeaning that README.md and CHANGELONG.md and t will be skipped when running dfm install.
You can make dfm install recurse into a given directory by adding its name to the .dfminstall file. For instance, the this .dfminstall file has the following contents:
.ssh recurse
README.md skip
t skipMeaning that (in addition to the above skips) instead of making ~/.ssh a symlink to ~/.dotfiles/.ssh, the ~/.ssh directory is left alone and files inside of ~/.dotfiles/.ssh are symlinked into ~/.ssh. Put another way, it turns this:
nate@host$ ls -al ~/.ssh
lrwxr-xr-x 1 nate staff 31 Sep 14 11:25 /Users/nate/.ssh -> .dotfiles/.sshinto this:
nate@host$ ls -al ~/.ssh
total 240
drwxr-xr-x 12 nate staff 408 Oct 14 16:50 .
drwxr-xr-x+ 82 nate staff 2788 Oct 15 23:43 ..
drwxr-xr-x 5 nate staff 170 Sep 14 11:25 .backup
lrwxr-xr-x 1 nate staff 33 Sep 14 11:25 config -> ../.dotfiles/.ssh/config
-rw------- 1 nate staff 1234 Aug 12 2010 id_dsa
-rw-r--r-- 1 nate staff 1234 Aug 12 2010 id_dsa.pub
-rw-r--r-- 1 nate staff 88264 Oct 13 14:55 known_hostsVery handy for managing files inside directories that are extra volatile or that you just want to leave alone.
You can make dfm install execute a script by adding its name to the .dfminstall file and appending the 'exec' option. For instance, given the following .dfminstall file:
setup.sh execWhen dfm install is run, the setup.sh script will be run after files at that level have been symlinked.
This is useful for manually differentiating one environment from another at install time rather than relying on something that can be detected.
You can combine this with the skip option so that the set up script doesn't get symlinked into the home directory. If that is desired, the skip option should appear on its own line. For example, to augment the above example to not symlink the setup.sh script:
setup.sh exec
setup.sh skipYou can make dfm install change the permissions on a file by adding its name to the .dfminstall file and appending the 'chmod' option and a mode. For instance, given the following .dfminstall file:
.ssh/config chmod 0600When dfm install is run, the .ssh/config file will have its mode set to 0600.
Adding new dotfiles to your repository can be a little tricky. Here are the commands that need to be run:
$ cp .vimrc .dotfiles
$ dfm install
$ dfm add .vimrc
$ dfm ci -m 'adding .vimrc'There is an import subcommand that accomplishes all of this:
$ dfm import .vimrc
INFO: Importing .vimrc from /home/user into /home/user/.dotfiles
INFO: Symlinking .vimrc (.dotfiles/.vimrc).
INFO: Committing with message 'importing .vimrc'
[personal 8dbf30d] importing .vimrc
1 file changed, 46 insertions(+)
create mode 100644 .vimrcHere are the subcommands that are currently defined:
-
install- this installs everything in the repo into$HOMEusing symlinks -
import- this adds a file (or directory) to the repo, symlinks it, and then does a commit. -
uninstall- the reverse ofinstall, this removes symlinks in$HOMEthat point into the dotfiles repository -
updates- this fetches any new changes from theoriginremote -
mergeandinstallormi- this merges any new changes and re-runsdfm install -
updatemergeandinstallorumi- this does the above two commands (updatesandmergeandinstall) in one - anything else is interpreted as a git subcommand and in run in the dotfiles repository. For instance, running
dfm statusis the same as runningcd ~/.dotfiles; git status; cd -, but easier.
For more information, run dfm --help or perldoc ~bin/dfm.