-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Problem
I set up page as my git pager:
:; git config core.pager 'page -O -t git'
:; git diff
[ 0000000376 | WARN | dump in page ]
cannot spawn bat, use stdout: Os { code: 2, kind: NotFound, message: "No such file or directory" }
diff --git ...Though it worked, I was confused about the warning, not knowing what it was or that it was a dependency that needed to be installed.
After looking through the source, I tried installing it:
:; git diff
[bat error]: unknown syntax: 'git'and now there's no output at all! One can't always assume that bat language names will match git filetypes.
Resolution
There appears to be no way to configure this behaviour. I could've set PAGE_LOG=error to silence all warnings, but there's no direct way to turn the bat fallback off. I also would be happy to run bat if the --language argument were omitted. I'd suggest:
- Some sort of argument/syntax that configures vim's filetype (
-t) and bat's language (--bat-language?-T?) separately - If
-Tdefaults to-t's value, there should be a way to clear it with-T autoor something - When a file path is provided instead of
stdin, preferbat --file-nameargument instead ofbat --language- this code seems incorrect, the extension is not a language and the filename should be passed instead if it is available.
(bat uses the filename to auto-detect the language, but unlike--language, it will not panic if it does not recognize it) - There should probably be a flag to explicitly turn bat on/off, perhaps
-T nonefor example.
Sopage -O -t pager -T autowould usebat, whilepage -O -t rust -T nonewouldcatinstead
I60R
Metadata
Metadata
Assignees
Labels
No labels