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]<p>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<p>[0] <a href="https://dandavison.github.io/delta/grep.html" rel="nofollow">https://dandavison.github.io/delta/grep.html</a><p>[1] <a href="https://github.com/sharkdp/bat">https://github.com/sharkdp/bat</a>
There was a good point made, that has stuck with me over the years. that our syntax highlighters are highlighting the wrong thing.<p>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.<p>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.<p>Unfortunately I don't remember where I read the original post and am unable to attribute it correctly.<p>update: while trying to look it up I found this <a href="https://www.wilfred.me.uk/blog/2014/09/27/the-definitive-guide-to-syntax-highlighting/" rel="nofollow">https://www.wilfred.me.uk/blog/2014/09/27/the-definitive-gui...</a>
Not as fancy, but if you want halfway reasonable word-level diffs with just standard issue git, this is often good enough:<p><pre><code> git diff --color-words --word-diff-regex='\w+|.'</code></pre>
Delta is great for what it does, but I consistently hit an issue where it truncates long lines. This post inspired me to check if the situation had changed... and it has! Now if you set `git config --global --replace-all delta.max-line-length 0`, it will no longer truncate lines. It's unclear to me why this is not the default. Discussion about the change is in <a href="https://github.com/dandavison/delta/pull/290">https://github.com/dandavison/delta/pull/290</a>.
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:<p><pre><code> --- a/some/path/to/file.c
+++ b/some/path/to/file.c
</code></pre>
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.
I've been using a mix of delta and difftastic both are amazing. Difftastic especially for tree-sitter AST syntaxes, it is a bit slower, but AST aware diff is so nice.<p>Delta looks clean, and is super fast
Here's a handy delta trick for you, to turn the side-by-side feature on and off based on window size. bash here, other shells left as an exercise:<p><pre><code> function delta_sidebyside {
if [[ COLUMNS -ge 120 ]]; then
DELTA_FEATURES='side-by-side'
else
DELTA_FEATURES=''
fi
}
trap delta_sidebyside WINCH</code></pre>
The thing that prevents me from using delta is lack of "system" theme detection. Can't set it up and forget and mismatching theme with shell makes it really difficult to read.
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?
I use a modified version of vimdiff as my daily diff tool:
<a href="https://gist.github.com/PhilipRoman/60066716b5fa09fcabfa6c95eaf7d170" rel="nofollow">https://gist.github.com/PhilipRoman/60066716b5fa09fcabfa6c95...</a><p>I find it easier to navigate that way since the diff of each file is in its own tab (yes I know... not how tabs are meant to be used)<p>For grep, vim's built in location list seems good enough. As for blame, I haven't used it since learning about git log -L. Vastly superior in my opinion.
What's a good way to convert the output of something like this into an html page?<p>We have non technical people looking at markdown PRs and commits in github and the diff viewer is terrible. It will highlight and entire paragraph because someone removed a trailing space. I use git-so-fancy locally which makes it much easier to see changes but I can't expect non-technical editors to move from their GitHub based workflow to a terminal based one
Looks like the author has also written magit integration for it: <a href="https://github.com/dandavison/magit-delta">https://github.com/dandavison/magit-delta</a><p>Any user feedback on how it is (perf etc) ?
i like bat, but they also link over to delta :D<p><a href="https://github.com/sharkdp/bat?tab=readme-ov-file#git-diff">https://github.com/sharkdp/bat?tab=readme-ov-file#git-diff</a>
This is pretty sweet. What's the recommended color scheme for default Ubuntu purple background terminals?<p><a href="https://raw.githubusercontent.com/dandavison/delta/main/themes.gitconfig" rel="nofollow">https://raw.githubusercontent.com/dandavison/delta/main/them...</a>
i knew git could use arbitrary diff filter but never realised it was this simple to use. This looks very nice.<p>The related? project "bat" also looks interesting.
Why? How does syntax coloring help in this context? I don't use syntax coloring at all in my editor, I don't think it adds any information or clues that help me understand the code. I think colored diff output (beyond red for deleted and green for added) just adds distractions.