Open cjappl opened 3 months ago
isn't it already possible ?
FORGIT_BLAME_PAGER='bat --color=always -l log' git forgit blame
FORGIT_BLAME_PAGER='bat --color=always -l gitlog' git forgit blame
isn't it already possible ?
FORGIT_BLAME_PAGER='bat --color=always -l log' git forgit blame
@ccoVeille this would color everything using the same syntax (log), but ideally we would have syntax highlighting based on the file.
bat
(which we already use for gbl
) supports syntax highlighting based on the file extension. We currently do not pass the file name to bat
and only pipe the content of the file when using gbl
. We could use the --file-name
parameter to make bat
use the correct syntax. I did a quick and dirty implementation to see what the results would look like. Some files look fine, e.g.
For others, the annotations get colored, since bat
isn't aware of them.
This is especially bad when using --color-by-age
or --color-lines
since it makes the highlights in the annotations less visible IMO:
Would be interested what others think, but I personally would value visible highlights from --color-lines
more than syntax highlighting in the context of git blame
.
delta has special highlighting for git blame. This can already be used when configuring delta as pager.
Thanks for your reply. It's clearer.
I like the implementation you made
@sandr01d I would also value the --color-lines
more than syntax highlighting of the file.
However, if delta supports git blame highlighting (which is cool, wasn't aware of that!), then we have a solution, don't we? We could add delta as a soft dependency, just like we do with bat
. How about that?
Personally, I am using diff-so-fancy
as a pager because I like its diff presentation more than delta's. That's personal preference, though, and I would actually like using delta
for gbl
if it does something useful there.
I agree with you @carlfriedrich. The AUR package already has delta
as an optional dependency and we also list it on our README. The only thing to look out for with delta
and blame is https://github.com/dandavison/delta/issues/1278, but this can be worked around with FORGIT_BLAME_GIT_OPTS="--date=iso8601"
for now.
@carlfriedrich it's indeed a good solution.
Also, you could mention delta as a recommended dependency. And the code react to delta
availability.
But it might be what you were thinking about
Currently if you use
gbl
you get a rather dull monochrome blame:It would be nice if we could put this through a nicer pager, or add syntax highlighting somehow.