mirror of
https://github.com/Xevion/dotfiles.git
synced 2026-01-31 08:24:11 -06:00
feat: add chezmoi merge tools with VSCode integration and Fish helper
- Add VSCode-based merge helper with clear visual layout explanation - Add Fish function for fzf-based interactive conflict selection - Update CLAUDE.md with .tmpl file search patterns and tool usage guidelines
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
function chmerge --description "Interactively merge chezmoi conflicts using fzf"
|
||||
# Get files with merge conflicts (MM = modified in both source and target)
|
||||
set -l conflict_files (chezmoi status | grep '^MM ' | awk '{print $2}')
|
||||
|
||||
if test (count $conflict_files) -eq 0
|
||||
echo "No merge conflicts found."
|
||||
return 0
|
||||
end
|
||||
|
||||
# Use fzf for selection with multi-select enabled
|
||||
set -l selected (printf '%s\n' $conflict_files | fzf \
|
||||
--multi \
|
||||
--preview 'chezmoi diff {}' \
|
||||
--preview-window 'right:70%:wrap' \
|
||||
--header 'Select files to merge (Tab for multi-select, Enter to confirm)' \
|
||||
--bind 'ctrl-/:toggle-preview')
|
||||
|
||||
if test (count $selected) -eq 0
|
||||
echo "No files selected."
|
||||
return 0
|
||||
end
|
||||
|
||||
# Convert to absolute target paths and merge
|
||||
for file in $selected
|
||||
# Expand ~ to home directory for chezmoi merge
|
||||
set -l target_path (string replace -r '^~' $HOME $file)
|
||||
echo "Merging: $file"
|
||||
chezmoi merge $target_path
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user