Delta: A syntax-highlighting pager for Git, diff, grep, and blame output
nateb2022 | 642 points | 7mon ago | github.com
SushiHippie|7mon ago
Delta has been one of those set and forget things, it's been a while since I've seen 'bare' git grep/diff/blame output, I also use it all the time for normal diffs (outside of git repos), but TIL that it also works with ripgrep [0]
As someone else already mentioned there is also bat[1], which was also set and forget, I aliased cat to bat and have a seperate alias vcat for 'vanilla cat' /usr/bin/cat
[0] https://dandavison.github.io/delta/grep.html
[1] https://github.com/sharkdp/bat
desperatecuban|7mon ago
You can use \cat to prevent alias expansion.
wlonkly|7mon ago
Or 'command cat', which is a little less convenient but will also handle the case where "cat" is a function, not an alias.
(In bash at least. Not sure about newfangled shells!)
drdude|7mon ago
Neat! thanks for sharing. Few times I needed that but I had to go hunting down the full path.
aroch|7mon ago
I have ‘ccat’ aliases to the original cat binary
SushiHippie|7mon ago
That's even better, thank you!
ossusermivami|7mon ago
or you can do =cat on zsh
somat|7mon ago
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...
milliams|7mon ago
This is what KDevelop called Semantic Highghting (as opposed to Syntax Highlighting). I think it was there earlier than this, but the earliest post I can find describing it is from 2009: https://zwabel.wordpress.com/2009/01/08/c-ide-evolution-from...
sicariusnoctis|7mon ago
The author of that post wrote "difftastic", which is "a structural diff that understands syntax" using treesitter.
aquariusDue|7mon ago
Totally agree, at first it looked alien to me but I've grown used to and prefer this way of highlighting. Personally I use color-identifiers-mode[0] for Emacs.
tjoff|7mon ago
We are pretty good at picking out variable names too... Especially if the grammar itself is highlighted since we then know exactly where to look / where not to look.
I'm not convinced of the argument, but still a bit curious.
I sometimes highlight a variable to follow it and make sure I don't miss an instance of it, so that I totally get. But not sure we have enough colors and contrast to make sense to follow many variables without cluttering everything up. A compromise might be to manually color up to 3 or something variables.
... but the cases where that helps may be a sign that the code isn't very readable to begin with (helping with messy codebases is a proper usecase though!).