-
-
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
Add documentation on how to get it working with git show #334
Comments
This is a really awesome looking tool by the way ! |
Thank you for the feedback. You can configure > git config --global pager.show bat However, Unfortunately, I don't know if there is any way to get more information from Note that you can always just use a pipe yourself. This way, you can explicitly set the syntax: > git show HEAD~3:src/main.rs | bat -lrs I guess it would also be easy to write a simple |
Small update: #205 is now implemented, so just configuring |
@dylan-chong Any update on this? |
I haven't tried because the issue that closes this only works be checking she shebang line at the start of the file, which doesn't really allow the syntax highlight to work most of the time
… On 12/10/2018, at 6:41 AM, David Peter ***@***.***> wrote:
@dylan-chong Any update on this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This works for me (bash or zsh): function git-show() {
local ref="$1"
local extension="${ref##*.}"
git show "$ref" | bat --language "$extension"
} |
That might be a little inconvenient because bash auto complete won't work on branch names. Oh well it's not a hugely important feature anyway
… On 12/10/2018, at 6:56 AM, David Peter ***@***.***> wrote:
git show doesn't provide any information about the filename to the pager, so I guess an external tool or shell function will be the only option.
This works for me (bash or zsh):
function git-show() {
local ref="$1"
local extension="${ref##*.}"
git show "$ref" | bat --language "$extension"
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yeah, sorry. I really don't think there is a better way unless someone wants to propose a change in Git such that it publishes the filename via some environment variable, for example 😄 |
My main use case for this program is to add syntax highlighting to
git show somebranch:somefile
. Would be possible to add some documentation on how to use bat as the default git show viewer.One thing to may be consider is a possible conflict with https://github.com/so-fancy/diff-so-fancy
The text was updated successfully, but these errors were encountered: