-
Notifications
You must be signed in to change notification settings - Fork 87
PluginChezmoi
Display the number of pending differences detected by chezmoi in a safe, non-interactive mode. The plugin appears in the status bar only when differences are detected, and disappears automatically when no supported differences remain.
3 # 3 differences detected - blue/info
7 # 7 differences detected - yellow/warning
25 # 25 differences detected - red/error
# (hidden when no supported differences are found)
| Property | Value |
|---|---|
| Platform | macOS, Linux |
| Dependencies | chezmoi |
| Content Type | dynamic |
| Presence | conditional (hidden when no supported differences are found) |
# macOS (Homebrew)
brew install chezmoi
# Linux (script install)
curl -fsLS get.chezmoi.io | bash
# Linux (Debian/Ubuntu)
sudo snap install chezmoi --classic
# or
wget https://github.com/twpayne/chezmoi/releases/latest/download/chezmoi_linux_amd64.deb
sudo dpkg -i chezmoi_linux_amd64.debMake sure chezmoi is initialized before using this plugin:
chezmoi init# Enable plugin
set -g @powerkit_plugins "chezmoi"# Enable plugin
set -g @powerkit_plugins "chezmoi"
# Icon
set -g @powerkit_plugin_chezmoi_icon ""
# Thresholds
set -g @powerkit_plugin_chezmoi_warning_threshold "5"
set -g @powerkit_plugin_chezmoi_critical_threshold "20"
# Exclude types that can trigger prompts or external side effects
set -g @powerkit_plugin_chezmoi_exclude_types "scripts,always,templates,encrypted,externals"
# Cache duration (seconds) - increase for large home directories
set -g @powerkit_plugin_chezmoi_cache_ttl "60"| Option | Type | Default | Description |
|---|---|---|---|
@powerkit_plugin_chezmoi_icon |
icon | |
Plugin icon |
@powerkit_plugin_chezmoi_warning_threshold |
number | 5 |
Number of pending differences to trigger warning health |
@powerkit_plugin_chezmoi_critical_threshold |
number | 20 |
Number of pending differences to trigger error health |
@powerkit_plugin_chezmoi_exclude_types |
string | scripts,always,templates,encrypted,externals |
Comma-separated chezmoi entry types excluded from safe status |
@powerkit_plugin_chezmoi_cache_ttl |
number | 60 |
Cache duration in seconds |
@powerkit_plugin_chezmoi_show_only_on_threshold |
bool | false |
Only show when warning/error threshold is exceeded |
| State | Condition | Visibility |
|---|---|---|
active |
chezmoi initialized, safe status found 1 or more pending differences | Visible |
inactive |
chezmoi not initialized, or no supported differences were found | Hidden |
| Level | Condition | Color |
|---|---|---|
info |
1 to warning_threshold - 1 pending differences |
Blue |
warning |
warning_threshold to critical_threshold - 1 pending differences |
Yellow |
error |
critical_threshold or more pending differences |
Red |
| Context | Description |
|---|---|
chezmoi_info |
Pending differences below warning threshold |
chezmoi_warning |
Pending differences at or above warning threshold |
chezmoi_error |
Pending differences at or above critical threshold |
The plugin shows just the number of pending differences detected by safe chezmoi status:
<count>
| Display | Meaning |
|---|---|
3 |
3 differences detected (info) |
7 |
7 differences detected (warning) |
25 |
25 differences detected (error) |
| (hidden) | No supported differences were found |
The plugin runs chezmoi status --no-pager --no-tty in safe mode and excludes entry types that commonly trigger prompts or side effects:
scriptsalwaystemplatesencryptedexternals
Each non-empty output line is counted as one pending difference.
This gives you real chezmoi source/target drift detection for supported entry types, while avoiding template rendering and secret manager prompts in setups that use Bitwarden or other secret backends.
Important limitation: if a file is managed as a chezmoi template or encrypted entry, it is excluded by default in safe mode, so differences in those entries will not be counted unless you change @powerkit_plugin_chezmoi_exclude_types.
Status codes reported by chezmoi status:
| Code | Meaning |
|---|---|
A |
Entry was added / will be created |
D |
Entry was deleted / will be deleted |
M |
Entry was modified / will be modified |
R |
Script would run |
set -g @powerkit_plugins "chezmoi"set -g @powerkit_plugins "group(git,chezmoi),group(cpu,memory),datetime"set -g @powerkit_plugins "chezmoi"
# Show warning when 3 or more files are pending
set -g @powerkit_plugin_chezmoi_warning_threshold "3"
# Show error when 10 or more files are pending
set -g @powerkit_plugin_chezmoi_critical_threshold "10"set -g @powerkit_plugins "chezmoi"
# Check status every 5 minutes instead of every minute
set -g @powerkit_plugin_chezmoi_cache_ttl "300"set -g @powerkit_plugins "chezmoi"
# Re-enable template checks if your setup does not prompt for secrets
set -g @powerkit_plugin_chezmoi_exclude_types "scripts,always,externals"- Make sure chezmoi is initialized:
chezmoi source-pathshould print a path without errors. - Make sure safe status finds differences:
chezmoi status --no-pager --no-tty --exclude "scripts,always,templates,encrypted,externals"should show output. - If the missing files are templated or encrypted, reduce
@powerkit_plugin_chezmoi_exclude_typesand accept that prompts may come back. - Check that
chezmoiis in your$PATH.
If your chezmoi tree is large, increase cache_ttl:
set -g @powerkit_plugin_chezmoi_cache_ttl "300"Clear the PowerKit cache to force an immediate re-check:
# Via keybinding (default: Ctrl+d if configured)
# Or manually:
rm -rf ~/.cache/tmux-powerkit/data/plugin_chezmoi_*
tmux source ~/.tmux.conf