jesseduffield / lazygit

simple terminal UI for git commands
MIT License
51.25k stars 1.79k forks source link

Multiple diff tool support #3375

Open cavanaug opened 6 months ago

cavanaug commented 6 months ago

Is your feature request related to a problem? Please describe. In my git config I have multiple diff tools available depending on my exact need. In particular I have jsondiff/dyff installed which allow for much better understanding of how a json config file or jsonschema file has changed.

Describe the solution you'd like Id like a way in the diff panel to switch to a different diff tool for the specific file. It would be ideal if this could be configured by file suffix so it would happen automatically, but a ui element to either cycle thru a set of diff tools or a ui element to select a diff tool would also be workable.

Describe alternatives you've considered Just use plain git to do the diffs, but that requires me to either open another window or exit lazygit and then re-enter.

mark2185 commented 6 months ago

Only tangentially related:

Just use plain git to do the diffs, but that requires me to either open another window or exit lazygit and then re-enter.

Why not run custom commands through : or predefine a custom command in your config?

visika commented 3 months ago

Why not run custom commands through : or predefine a custom command in your config?

Is there a way to quickly reference the desired file? e.g. I want to run git diff-image on the file highlighted in lazygit. I could use : to write out the full command, but it doesn't seem fast for me because I have no completion.

visika commented 3 months ago

About my previous comment, I discovered that with custom commands I can run a command on the file selected in lazygit with just a keybinding.

In practice, if I add the example code below to lazygit config file (~/.config/lazygit/config.yml), I can use a different diff tool just pressing F1 with the desired file selected:

customCommands:
  - key: '<f1>'
    context: 'files'
    command: 'git diff-image "{{ .SelectedFile.Name }}"'
    loadingText: "opening git diff-image"
    subprocess: false