-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More Git features? #440
Comments
Thank you for the feedback.
I don't really see a huge need for having
We already do that - in a minimal form.
So how would that look like? How do you display both the syntax highlighting as well as the additions/deletions.
Please see the related issue #23 where we plan to do something similar for
Passing SHA-1s/branches/tags/etc. to diff against sounds like a useful idea. However, we would probably always display the current version of the file and simply change the target to show the diff/modifications against.
This has been requested in #274 as well. Unfortunately, there is no way to get There is also a fundamental problem with this approach: Syntax highlighting only works if you know the whole context (think of multiline comments). To do it right, you would have to syntax-highlight the original file, the current version of the file and then show the syntax-highlighted diff. If you just use |
Sorry for the duplicate-ish post...Evidently I don't know how to search the issues list or I would have found some subset of issues 23, 274, and 334. A couple thoughts
Regarding the required context for the syntax highlighting to work: my ideal use case is really an extension of the existing git integration, so we're talking about the entire file being available to bat:
Somehow bat already knows where lines have been removed, changed, or added, so my hope was that it wouldn't be difficult to insert blocks of text holding the previous incarnation of the affected lines into the overall syntax-highlighted file. |
Also related to #369 (using bat as a git pager) |
Ok, I think that could work. Basically we just do what we do now but print the old lines in addition (grayed out). We do not need |
@jetzerb I'm going to close this ticket as it includes three requests at once which is difficult to track. It would be great if you could open a new ticket for the feature request concerning the dim gray lines. If you want to further discuss the other two points (git blame, using bat as a git pager), please use the existing tickets or open new tickets as appropriate. Thank you. |
Sweet. I don't know how much info you can get out of libgit, but if you can highlight the bits of text in the old lines that have changed, that would be even better. Like diff-so-fancy does. |
Feature requests for more git integration. Some ideas:
Show
git blame
infoShow abbreviated commit id, user, date of change) along with the syntax highlighting.
Show
git diff
infoGo one step further and show the diff between the current version and the immediately-preceding version. Something roughly equivalent to
git diff -U1000 1a2b3c4d FileName.foo | bat -l foo
but with good highlighting on the modified lines in addition to syntax highlighting.-U
option togit diff
specifies number of lines of context. I just threw in a big number here, but the idea would be that we can see the entire file regardless of how big it is.1a2b3c4d
represents the previous commit to the file. Maybe make a--diff
option that takes 0, 1, or 2 arguments:--diff
: diff from the previous commit to current version--diff 1a2b3c4d
: diff from specified commit to current version--diff 1a2b3c4d 2b3c4d5e
: diff from first commit to secondBat As Git Pager
Or perhaps it's easier to come at
git diff
from the other side, and makebat
smart enough to do syntax highlighting when it is specified as git's pager. Result would be similar to that achieved with diff-so-fancy, but with syntax highlighting specific to each file in the diff.The text was updated successfully, but these errors were encountered: