nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.99k stars 1.81k forks source link

programs.git.difftastic: Add support for configuring as difftool #3140

Open lilyball opened 2 years ago

lilyball commented 2 years ago

Description

Difftastic has documentation on configuring it as a difftool. It would be great if home-manager had a programs.git.difftastic.enableDifftool option that set up the difftool config, so I could set that instead of programs.git.difftool.enable if I'm already using a conflicting tool (like delta).

According to the linked documentation, the difftool config looks like

[diff]
        tool = difftastic

[difftool]
        prompt = false

[difftool "difftastic"]
        cmd = difft "$LOCAL" "$REMOTE"

In this case, the config option should just set the difftool.difftastic.cmd config (such that git difftool -t difftastic works). The others can be configured separately by the user as desired.

The primary use-case of this option is to allow the existing programs.git.difftastic options to apply to the newly-configured difftool.

Alternatives considered

The option here could be called programs.git.difftool.difftastic.enable instead, but that makes it less obvious that the programs.git.difftastic options would apply.

programs.git.difftastic could gain a read-only option cmd that contains the command string, thus allowing users to set programs.git.extraConfig.difftool.difftastic.cmd = config.programs.git.difftastic.cmd, though this feels awkward and harder to document.

An option programs.git.difftool could be added that's an enum that currently just allows the string "difftastic", which would not only set programs.git.difftastic.enableDifftool to true but would also set the diff.tool and difftool.prompt configs, along with pager.difftool = true as recommended by the linked documentation. It might also want to default core.pager to the same value that programs.git.difftastic.enable sets.

Maintainers

@rycee

stale[bot] commented 1 year ago

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

pcasaretto commented 2 weeks ago

I see we have programs.git.difftastic.enable. Should this be closed?

thecaralice commented 2 weeks ago

I see we have programs.git.difftastic.enable. Should this be closed?

No. The issue is with programs.git.difftastic.enable conflicting with programs.git.delta.enable which was not fixed. Neither does programs.git have any special things for difftool options.