Live data from Hacker News

Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

github.com

71–80 of 98 posts

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#71
post #55

I saw this recently and thought "great!" and tried it out, thinking I would love it. But somehow I actually prefer the way git already does it, even if it seems inferior to me. Maybe I'd just have to get used to it?

Same for me. I don't know, delta seems more like a chaos I can't make sense of than default git diffs

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#72

Earlier quoted context omitted.

Hi, delta now automatically detects whether the terminal background is light or dark and selects a theme accordingly. (This is due to the nice work of contributor bash: https://github.com/bash/terminal-colorsaurus )

On a not-so-completely unrelated note, if you didn't know on GitHub READMEs you can do things like ![img-text](assets//myimg_dark.png#gh-dark-mode-only) ![img-text](assets/myimg_light.png#gh-light-mode-only) To automatically display the light or dark version of images depending on their gh theme (works html style too) I'm also fond of .... Which I notice you do :), but did you know you could also do it to tables and…

Thanks! https://github.com/dandavison/delta/pull/1893

> To automatically display the light or dark version of images depending on their gh theme

Ah, good call. That could be a nice improvement -- creating light and dark versions of the screenshots with switching as you describe.

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#73
post #29
post #4

I use both delta and difftastic (difft), and cannot recommend them enough. If you use the terminal at all, get them!

I've been using difftastic for a while. How do you use both together?

I have `delta` as my default and for difft, I use the following:

`env GIT_EXTERNAL_DIFF=difft git log -p --ext-diff`

Hope it helps :)

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#74

Earlier quoted context omitted.

can broot scroll the file preview on the right? ranger can do it, so far I feel ranger is better

Ranger seems quite slow for the directories I tried to use it on. Use lf, may give broot a try.

speedy for me all these years

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#75

Earlier quoted context omitted.

On a not-so-completely unrelated note, if you didn't know on GitHub READMEs you can do things like ![img-text](assets//myimg_dark.png#gh-dark-mode-only) ![img-text](assets/myimg_light.png#gh-light-mode-only) To automatically display the light or dark version of images depending on their gh theme (works html style too) I'm also fond of .... Which I notice you do :), but did you know you could also do it to tables and…

Thanks! https://github.com/dandavison/delta/pull/1893 > To automatically display the light or dark version of images depending on their gh theme Ah, good call. That could be a nice improvement -- creating light and dark versions of the screenshots with switching as you describe.

It’s beautiful, I love it

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#76
post #29
post #4

I use both delta and difftastic (difft), and cannot recommend them enough. If you use the terminal at all, get them!

I've been using difftastic for a while. How do you use both together?

I have this set as an alias:

difft = -c diff.external=difft diff

I may add a similar alias for delta

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#77

I want to like this having used regular `git diff` tool with colours, but this is just too busy.

you might like diffr ( https://github.com/mookid/diffr ) (disclaimer: my project)

Very nice, I've been looking for something like this since completing a port of DiffMatchPatch. I'll going to give it a spin right away, thanks for sharing your hard work!

As a bit of feedback, you might wish to put a section showing how to make a git alias for diffr, to complement the section on how to install it as the default. I know how to do this already, because I use delta and dft depending on what I need to see, but it would be useful to others to have a copy-paste solution handy.

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#78
There was a good point made, that has stuck with me over the years. that our syntax highlighters are highlighting the wrong thing.

They should not be coloring the grammar, we are good at picking out grammar, they should be highlighting the symbols. each different variable and function name should be getting it's own color. that is, the goal is to make it quicker to distinguish different symbols, not that they are a symbol.

But this is much harder than stylizing the grammar so all our tooling sticks with the easy thing rather that the useful thing. Now, I am being a bit mean on grammar styling. It does help quite a bit but I would like to see a symbol matching engine in action to see if that really works.

Unfortunately I don't remember where I read the original post and am unable to attribute it correctly.

update: while trying to look it up I found this https://www.wilfred.me.uk/blog/2014/09/27/the-definitive-gui...

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#79
post #54

Speaking of diffs, one thing that annoys me about Git's diff output is that is prints file paths like Unix diff traditionally does, starting with the two file names: --- a/some/path/to/file.c +++ b/some/path/to/file.c I often cmd-click in iTerm to open a file in an editor, but this doesn't work here because of the a/ and b/ prefixes. Any way to make Git format the file name better? I don't even need two lines here.

git config --global diff.noprefix true Checkout the manual for more prefix options.

Perfect, thank you.

Re: Delta: A syntax-highlighting pager for Git, diff, grep, and blame output

#80
post #78

There was a good point made, that has stuck with me over the years. that our syntax highlighters are highlighting the wrong thing. They should not be coloring the grammar, we are good at picking out grammar, they should be highlighting the symbols. each different variable and function name should be getting it's own color. that is, the goal is to make it quicker to distinguish different symbols, not that they are a s…

The author of that post wrote "difftastic", which is "a structural diff that understands syntax" using treesitter.

https://difftastic.wilfred.me.uk/

https://github.com/Wilfred/difftastic

Post reply on HN