I'm using bat on MacOS, installed using Homebrew (0.12.1). I'm on Catalina.
Some files (pycodestyle, isort.cfg) that I try to open simply don't show. Terminal exits with a success code.
I can't reproduce this on Mojave. Can you paste an example file so I can verify it's not the file or syntax highlighting causing it?
Sure, below is my pycodestyle:
[pycodestyle]
max_line_length = 120
And my bat config:
# Show line numbers, Git modifications and file header (but no grid)
--style="numbers,changes,header"
# Use italic text on the terminal (not supported on all terminals)
--italic-text=always
# Add mouse scrolling support in less (does not work with older
# versions of "less")
--pager="less -FR"
# Use C++ syntax (instead of C) for .h header files
--map-syntax h:cpp
# Use "gitignore" highlighting for ".ignore" files
--map-syntax .ignore:.gitignore
Thanks! Still can't confirm it on my version of MacOS, so it's looking like I might have to set up a virtual machine and try it on Catalina later.
Thanks for checking, @eth-p! Is there any additional debugging I can do to help?
A couple more questions:
--no-config flag?sw_vers?Is there any additional debugging I can do to help?
If you would be able to build bat from master and tell me if that works correctly, it might make things a bit easier to figure out if it's a bat issue or an issue with the homebrew-compiled artifacts. The compiler shipped with Xcode during the early releases of Catalina emitted bad code, and this could be another instance of that.
- Does it work if you use the
--no-configflag?
Yes! Just tried it and that's the first time I've seen this file with bat 馃槄.
- Did you install any custom themes or syntaxes?
Only 1 theme, Dracula.
- Do you have a wrapper script/function around bat?
No.
- Output of
sw_vers?
ProductName: Mac OS X
ProductVersion: 10.15.3
BuildVersion: 19D76
If you would be able to build
batfrom master and tell me if that works correctly, it might make things a bit easier to figure out if it's abatissue or an issue with the homebrew-compiled artifacts. The compiler shipped with Xcode during the early releases of Catalina emitted bad code, and this could be another instance of that.
I see. I'll try this in a couple days.
Commenting out --pager="less -FR" from my bat config fixes it and displays the file, so it has something to do with the pager.
Yes! Just tried it and that's the first time I've seen this file with bat.
Interesting... Something in your config must be causing this issue. Could you try the following:
bat --no-config --style="numbers,changes,header" pycodestylebat --no-config --italic-text=always pycodestylebat --no-config --pager="less -FR" pycodestylebat --no-config --map-syntax h:cpp pycodestylebat --not config --map-syntax .ignore:.gitignore pycodestyleWhichever ones don't work, let me know. It should help figure out which config option that I"ll need to look more closely at.
Commenting out
--pager="less -FR"from my bat config fixes it and displays the file, so it has something to do with the pager.
Tried that on my own before seeing your comment, the culprit appears to be the pager.
Thanks! What version of less are you using?
I'm on: less 487
That explains it! Your version of less is affected by the --quit-if-one-screen bug where it immediately enters and exits the terminal's alternate screen mode. Bat is actually doing something, but because less does that, you never get to see the output.
If you try viewing other files smaller than your terminal, you'll run into this exact same issue.
You have a couple options for fixing it, too. You can either remove that line from your config, or you can run brew install less to update to a newer version that patches it. I would recommend the latter, since it would also fix mouse wheel scrolling.
I was under the impression that less was installed from homebrew for me, but clearly not. Installing it from homebrew fixed it.
Thanks, @eth-p!
This info might be a good candidate for an addition to the "Troubleshooting" section of the README. It took me a minute to figure out that the pager was the culprit for the lack of output!
Nevermind, I saw that this was in the "Pager" section already. 馃槄
Most helpful comment
I was under the impression that less was installed from homebrew for me, but clearly not. Installing it from homebrew fixed it.
Thanks, @eth-p!