Skip to content

Search and filetree in diffs #366

@abourget

Description

@abourget

Is your feature request related to a problem? Please describe.

I need to be able to search diffs, and jump to files in a diff, to study it fast

I use gitk usually for this. So only missing things here:

  • being able to jump to a file when viewing a diff,
  • being able to search the diff, to find the chunk of code I want to understand better

Describe the solution you'd like

I think hitting d to view a diff is great, but then, in there, I'd like to have 4 more shortcuts:

  • / to be able to search inside the diff view.. just plain text.. and go there
  • N and n to go back and forth the matches, like in vim (why not g and G, end/home, like vim)
  • t that would pop up a fuzzy search, to get down to the file I want.. and also see quickly which files are int he diff when the patches are long.
    • I could already jump to files that I know the name with the search.. but seeing the list is often useful, to see the sort of broadness of patches, the impact of it too.

Describe alternatives you've considered

Right now, to study the diffs, I need to have this command:

diffnav has a great t shortcut, with fuzzy search. See the demo here: https://github.com/dlvhdr/diffnav
It looks like GitHub's t.. It's missing the / search though, making diffnav not ideal either, and it brings you outside, in a less familiar place.

Here's my command to get to it:

[custom_commands]
"diffnav from checked" = { args = ["util", "exec", "--", "bash", "-c", """
jj diff --from $checked_commit_ids --to $change_id --color=always --summary --git | diffnav
"""], show = "interactive" }

(allows me to diff between separate commits by choosing one.. that I haven't found a way to do natively in jjui and I do that all the time in gitk).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions