Hi,
Right now, the hunk header only shows the line number. diff-so-fancy also shows the file path, which I like because it gives me better orientation in a large diff (although it can be redundant with the commit/file box).
Is it possible to emulate this in delta?
Thanks!
Hi @infokiller, that's very interesting, I didn't know (or had forgotten; I used d-s-f for many years) that diff-so-fancy did that. I think I might like that also -- as you say, in large multi-file diffs, I do find myself looking at a hunk and then having to scroll up or something to confirm what file it's in.
This would be great to add!
A related idea is to hyperlink the hunk context. Right now the context line number looks a bit off to me.

Especially for e.g. removed files:

I know I can disable it with line-numbers = false, but that loses out the hunk context link too.
I'm aware that the hunk context isn't at the line number reported, but as the hunk context line number doesn't refer to the first line of the context, but to the first line where there's a change, the line number is "wrongly placed" anyways, and merging it into the hunk context (function) line would simplify things visually.
This would also make it easier to open the file directly at the given line number for a hunk, with tools that understand the file:lineno format (like Vim with the vim-fetch extension).
This is implemented in master (not yet released). To select the new behavior, you use a special style attribute file in hunk-header-style. This causes the file path to be included in the hunk header. For example: hunk-header-style = file syntax. The style for the file path is determined by file-style.
It is possible to omit the main file section and display hunk headers only. Here's an example:
[delta]
hunk-header-style = file syntax # use new attribute
file-style = red omit # set the color for the file path, but omit the main file section
hunk-header-decoration-style = blue box ul
![]() |
Feedback and/or testing of master branch welcome.
@torarnv I don't want to lose your idea above (https://github.com/dandavison/delta/issues/309#issuecomment-703152533). Maybe we should open a new ticket for it. Do you use the file/line-number hyperlinks? (Have you set things up so they open in an editor/IDE?)
Most helpful comment
Hi @infokiller, that's very interesting, I didn't know (or had forgotten; I used d-s-f for many years) that diff-so-fancy did that. I think I might like that also -- as you say, in large multi-file diffs, I do find myself looking at a hunk and then having to scroll up or something to confirm what file it's in.