difftastic icon indicating copy to clipboard operation
difftastic copied to clipboard

Feature request: navigation keybindings

Open anuramat opened this issue 6 months ago • 2 comments

summary

add option to prepend labels (i.e. rare unicode symbols) to filenames/hunks

now if you set pager to less "+/$PATTERN"$'\ng', where $PATTERN matches the label(s), you can jump between files/hunks with n/N

motivation

spamming f gets annoying on large diffs with a lot of big irrelevant hunks

stolen from

delta's navigate:

workaround

without labels you could use:

  • --- \S+$ for hunks
  • (?<! --- ([2-9]|\d{2,6})/\d{1,6}) --- \S+($| [^-]) for files (as long as you have less than 10e6 hunks and the regex flavor supports all the magic)

anuramat avatar Jun 10 '25 13:06 anuramat

idk how I didn't think of that earlier, but you can just wrap difft with a script

printf '\u2063'
exec difft "$@"

and then set the pager to less -p $'\u2063', where U+2063 is the invisible separator character; hunks are still a problem though

anuramat avatar Aug 30 '25 02:08 anuramat

The above script would need to iterate over the parameters in $@ and printf between each single file invocation of difft if I understand your idea correctly, right?

sfleiter avatar Dec 02 '25 11:12 sfleiter