From b10422f8fd870c99c2ae998a749f6a5b56178787 Mon Sep 17 00:00:00 2001 From: omair-inam Date: Fri, 27 Feb 2026 08:01:43 -0500 Subject: [PATCH] feat(chezmoi): add aliases for common chezmoi commands Add 14 aliases to the chezmoi plugin covering the core dotfile management workflow. Aliases follow the OMZ naming convention (cm prefix + first letters of subcommand). Co-Authored-By: Claude Opus 4.6 --- plugins/chezmoi/README.md | 23 +++++++++++++++++++++-- plugins/chezmoi/chezmoi.plugin.zsh | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/plugins/chezmoi/README.md b/plugins/chezmoi/README.md index 32aee73b2..e29f26628 100644 --- a/plugins/chezmoi/README.md +++ b/plugins/chezmoi/README.md @@ -2,10 +2,29 @@ ## Introduction -This `chezmoi` plugin sets up completion for [chezmoi](https://chezmoi.io). +This `chezmoi` plugin provides completion and [aliases](#aliases) for [chezmoi](https://chezmoi.io). To use it, add `chezmoi` to the plugins array of your zshrc file: -```bash +```zsh plugins=(... chezmoi) ``` + +## Aliases + +| Alias | Command | Description | +| :----- | :--------------------- | :----------------------------------------------------- | +| `cm` | `chezmoi` | The base chezmoi command | +| `cma` | `chezmoi add` | Add a file to the source state | +| `cmap` | `chezmoi apply` | Update the destination to match the target state | +| `cmcd` | `chezmoi cd` | Launch a shell in the source directory | +| `cmd` | `chezmoi diff` | Print the diff between target state and destination | +| `cme` | `chezmoi edit` | Edit the source state of a target | +| `cmg` | `chezmoi git` | Run git in the source directory | +| `cmi` | `chezmoi init` | Set up the source directory | +| `cmia` | `chezmoi init --apply` | Set up the source directory and apply in one step | +| `cmm` | `chezmoi merge` | Three-way merge for a file | +| `cmma` | `chezmoi merge-all` | Three-way merge for all modified files | +| `cmra` | `chezmoi re-add` | Re-add modified files | +| `cmst` | `chezmoi status` | Show the status of targets | +| `cmu` | `chezmoi update` | Pull and apply changes from the remote | diff --git a/plugins/chezmoi/chezmoi.plugin.zsh b/plugins/chezmoi/chezmoi.plugin.zsh index 80e19fea1..d730e9382 100644 --- a/plugins/chezmoi/chezmoi.plugin.zsh +++ b/plugins/chezmoi/chezmoi.plugin.zsh @@ -12,3 +12,23 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then fi chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &| + +# +# Aliases +# (sorted alphabetically by alias name) +# + +alias cm='chezmoi' +alias cma='chezmoi add' +alias cmap='chezmoi apply' +alias cmcd='chezmoi cd' +alias cmd='chezmoi diff' +alias cme='chezmoi edit' +alias cmg='chezmoi git' +alias cmi='chezmoi init' +alias cmia='chezmoi init --apply' +alias cmm='chezmoi merge' +alias cmma='chezmoi merge-all' +alias cmra='chezmoi re-add' +alias cmst='chezmoi status' +alias cmu='chezmoi update'