From 3ee25fb90c4549e5ce3392b52744000e3eb156d3 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 29 Dec 2025 18:35:52 -0600 Subject: [PATCH] feat: enhance chezmoi fzf tools with bat syntax highlighting for diffs/file previews --- home/dot_config/fish/functions/chai.fish.tmpl | 2 +- home/dot_config/fish/functions/chshow.fish.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/dot_config/fish/functions/chai.fish.tmpl b/home/dot_config/fish/functions/chai.fish.tmpl index 49d2ee5..8af47ce 100644 --- a/home/dot_config/fish/functions/chai.fish.tmpl +++ b/home/dot_config/fish/functions/chai.fish.tmpl @@ -23,7 +23,7 @@ function chai --description "Interactive chezmoi apply with fzf diff preview" --with-nth=4 \ --nth=1 \ --prompt='Apply Changes > ' \ - --preview='chezmoi diff {1} 2>/dev/null | head -100' \ + --preview='chezmoi diff {1} 2>/dev/null | bat -pp --color=always --language=diff' \ --preview-window=right:60%:wrap \ --multi \ --bind='ctrl-a:toggle-all' \ diff --git a/home/dot_config/fish/functions/chshow.fish.tmpl b/home/dot_config/fish/functions/chshow.fish.tmpl index e2951bc..b2f079c 100644 --- a/home/dot_config/fish/functions/chshow.fish.tmpl +++ b/home/dot_config/fish/functions/chshow.fish.tmpl @@ -14,7 +14,7 @@ function chshow --description "Browse chezmoi managed files with fzf preview" --with-nth=4 \ --nth=1,2 \ --prompt='Chezmoi Files > ' \ - --preview='chezmoi cat {1} 2>/dev/null || echo "Preview unavailable"' \ + --preview='chezmoi cat {1} 2>/dev/null | bat -pp --color=always --file-name={1} 2>/dev/null || echo "Preview unavailable"' \ --preview-window=right:60%:wrap \ --expect='ctrl-e' \ --header='Enter: view | Ctrl+E: edit source')