Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update docs for using delta #4207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

KapJI
Copy link
Contributor

@KapJI KapJI commented Jan 13, 2025

Delta documentation suggests to set it only as pager for Git, not as diff command. For chezmoi we need the same to have paging work correctly. Pager should be configured for delta separately, either as command line flag, .gitconfig or BAT_PAGER env var.

Closes #4205

@twpayne
Copy link
Owner

twpayne commented Jan 14, 2025

Thanks very much for this!

I'd like to do some more testing before merging this. chezmoi's integration with external diff tools and pagers is a bit of a mess for both inherent complexity and legacy reasons.

Inherent complexity:

  • Some diff tools act like diff, taking filenames as arguments, and producing a diff, i.e. you use them as a diff tool.
  • Other diff tools act as pagers, reading git diff-like input from stdin and reformatting the diff, i.e. you use them as a pager.
  • Many diff tools add color to the output and/or expect to have control of the terminal.
  • Many diff tools can only handle differences between existing regular files, and fail messily when presented with anything else, e.g. adding or removing a file, adding a directory, replacing a symlink with a device node, etc.
  • Also, the interaction varies across operating systems (e.g. Windows requires special terminal handling).

Legacy reasons:

  • chezmoi initially supported setting the pager, and this has since grown into pagers, diff commands, diff pagers, and all the associated complexity with managing these while maintaining backwards compatibility for existing users. Right now, it's a bit of a mess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

diff pager not respected when using delta as diff command
3 participants