This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!
chezmoi¶
chezmoi helps you manage your personal configuration files (dotfiles, like ~/.gitconfig) across multiple machines.
chezmoi provides many features beyond symlinking or using a bare git repo including: templates (to handle small differences between machines), password manager support (to store your secrets securely), importing files from archives (great for shell and editor plugins), full file encryption (using gpg or age), and running scripts (to handle everything else).
Reference(s)
Table of contents¶
Install¶
Config¶
-
Initialize chezmoi:
-
Create yourself a dedicated
dotfile
repository on a Git server, and link your local chezmoi to it:
Use¶
-
Get help if needed:
-
Check common problems. If you encounter something unexpected, run this first.
-
Add dotfiles:
-
Edit dotfiles with chezmoi (you have 4 different options for doing it):
-
Use
$ chezmoi edit $FILE
. This will open the source file for$FILE
in your editor. Optionally, you can use$ chezmoi edit --apply $FILE
to apply the changes when you quit your editor, -
Use
chezmoi cd
and edit the files in the source directory directly. Then run$ chezmoi apply
to make the changes. -
Edit the file in your home directory, and then either re-add it by running
$ chezmoi add $FILE
or$ chezmoi re-add
. -
Edit the file in your home directory, and then merge your changes with source state by running
$ chezmoi merge $FILE
(invoking a merge tool, by defaultvimdiff
)
-
-
Show a quick summary of what files would change if you ran chezmoi apply:
-
Shows changes that
$ chezmoi apply
would make to your home directory: -
Apply changes locally (i.e. apply what's in
$HOME/.local/share/chezmoi
to your local dotfiles): -
Automatically apply changes whenever a file is saved (after editing the file with chezmoi):
Working across multiple machines¶
-
Initialize chezmoi from another machine with your dotfiles repository:
(then, just apply changes locally)
-
Initialize chezmoi and apply changes from another machine with your dorfile repository, in a single command:
-
Pull and apply the latest changes, on any machine, from your repository:
-
Pull the latest changes from your repository and see what would change, without actually applying the changes:
Working with templates¶
-
Print the available template data (including the full list of variables specified for templates):
-
Add a file as a template:
-
Makes an existing file a template:
-
Print the target contents of a file, without changing the file:
-
Test and debugg templates:
If this cheat sheet has been useful to you, then please consider leaving a star here.