Home

Awesome

dotfiles Command

CI Coverage

This repository provides dotfiles command to manage your dotfiles. It manages your dotfiles repository and symbolic links to use the configurations.

This command has below goals:

Note: My dotfiles is here

Getting Started

  1. Download a released executable and put it in $PATH or $ go install github.com/rhysd/dotfiles.
  2. Change current directory to the directory you want to put a dotfiles repository.
  3. Clone your dotfiles repository with $ dotfiles clone.
  4. Enter the repository and run $ dotfiles link --dry to check which symlinks will be generated.
  5. Write .dotfiles/mappings.json if needed.
  6. $ dotfiles link
  7. After you no longer need your configuration, remove all links with $ dotfiles clean.

Usage

$ dotfiles {subcommand} [arguments]

clone subcommand

Clone your dotfiles repository from remote.

# Clone git@github.com:rhysd/dotfiles.git into current directory
$ dotfiles clone rhysd

# Clone https://github.com/rhysd/dotfiles.git into current directory
$ dotfiles clone rhysd --https

# You can explicitly specify the repository name
$ dotfiles clone rhysd/dogfiles

# You can also use full-path
$ dotfiles clone git@bitbucket.org:rhysd/dotfiles.git
$ dotfiles clone https://your.site.com/dotfiles.git

link subcommand

Set symbolic links to put your configuration files into proper places.

$ dotfiles link [options] [files...]

You can dry-run this command with --dry option.

If some files in dotfiles repository are specified, only they will be linked.

list subcommand

Show all links set by this command.

$ dotfiles list

clean subcommand

Remove all symbolic link put by dotfiles link.

$ dotfiles clean

update subcommand

git pull your dotfiles repository from anywhere.

$ dotfiles update

selfupdate subcommand

Update dotfiles binary (or dotfiles.exe on Windows) itself.

$ dotfiles selfupdate

Default Mappings

It depends on your platform. Please see source code.

Symbolic Link Mappings

dotfiles command has sensible default mappings from configuration files in dotfiles repository to symbolic links put by dotfiles link. And you can flexibly specify the mappings for your dotfiles manner. Please create a .dotfiles directory and put a .dotfiles/mappings.json file in the root of your dotfiles repository.

Below is an example of mappings.json. You can use ~ to represent a home directory. As key, you can specify a name of file or directory in your dotfiles repository. They will be linked to the corresponding values as symbolic links.

{
  "gitignore": "~/.global.gitignore",
  "cabal_config": "~/.cabal/config"
}

In addition, you can define platform specific mappings with below mappings JSON files.

Below is an example of .dotfiles/mappings_darwin.json.

{
  "keyremap4macbook.xml": "~/Library/Application Support/Karabiner/private.xml",
  "mac.vimrc": "~/.mac.vimrc"
}

Values of the mappings object are basically strings representing destination paths, but they also can be arrays of strings. In the case, multiple symbolic links will be created for the source file.

For example, the following configuration will make two symbolic links ~/.vimrc and ~/.config/nvim/init.vim for vimrc source file.

{
  "vimrc": ["~/.vimrc", "~/.config/nvim/init.vim"]
}

Real world example is my dotfiles.

License

Licensed under the MIT license.