What version of bat are you using?
bat 0.15.4
Describe the bug you encountered:
PAGER environment variable:bash
$ echo $PAGER
less --quit-if-one-screen --tabs=1
$ echo -e "1234567890\n\ttest=1" | bat
STDIN
1 1234567890
2 test=1
bat uses 4.BAT_PAGER env variable (same as above but using BAT_PAGER instead of PAGER)pager argument in the config file (see below)pager argument directly:bash
echo -e "1234567890\n\ttest=1" | bat --pager="less --quit-if-one-screen --tabs=1"
Describe what you expected to happen?
PAGER env variable is used for pager command of bat.src/bin/bat/config.rs:66 I read it as the value should be only arguments, but in reality it expects to prefix it with the less command.)less directly after echo produces correct amount of spaces:bash
$ echo $LESS # instead of $PAGER
--quit-if-one-screen --tabs=1
$ echo -e "1234567890\n\ttest=1" | less
1234567890
alma=1
How did you install bat?
cargo install --git https://github.com/sharkdp/bat.git --tag v0.15.4
$ uname -srm
Linux 4.15.0-101-generic x86_64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
$ bat --version
bat 0.15.4
$ env
PAGER=less --quit-if-one-screen --tabs=1
BAT_CONFIG_PATH=/home/pcdevil/.batrc
$ cat /home/pcdevil/.batrc
--theme="Dracula"
--style="numbers,changes,header"
--paging=always
--pager="less --quit-if-one-screen --tabs=1"
No wrapper script for 'bat'.
No wrapper function for 'bat'.
No wrapper function for 'cat'.
$ less --version
less 551 (POSIX regular expressions)
Bat itself actually expands the tabs, which is why less --tabs=1 isn't working for you. That was done because of tabstop alignment issues when the sidebar is visible, but you can disable it by adding --tabs=0 to your bat config file. Or, if you just want to change the width of the tabs, you can use --tabs=1 to set it to a single space character
Hey,
Thank you for the response, you are right, letting less do the indenting makes an issue due to the line numbering!
Mind if I create a PR for mentioning this in the Readme, alongside the modification of src/bin/bat/config.rs:66 to reflect how bat works?
By all means. Contributions are always welcome!
Thanks, created the merge request for it: #1103
Most helpful comment
Bat itself actually expands the tabs, which is why
less --tabs=1isn't working for you. That was done because of tabstop alignment issues when the sidebar is visible, but you can disable it by adding--tabs=0to your bat config file. Or, if you just want to change the width of the tabs, you can use--tabs=1to set it to a single space character