bat How do you remove secondary line numbers column? - Rust

I'm aware that the line numbers column can be removed with --style=plain but how does one remove the other line numbers column?

screenshot: https://i.imgur.com/srD0Jys.png

Asked Oct 19 '21 20:10
avatar pentago
pentago

6 Answer:

Godamn. I had the following env var configured in .zshrc: export LESS='-sMEFRNXI' where N shows line numbers. Once I removed it from the rest of the flags, bat started working nicely.

THanks for pointing me in right direction! Didn't know bat depends on less for displaying.

1
Answered Mar 17 '21 at 19:44
avatar  of pentago
pentago

Hi!

Can you reproduce this problem everywhere? I can not reproduce. Can you provide detailed step-by-step instructions on how to reproduce please?

It would also be helpful if you could paste the output of bat --diagnostic

1
Answered Mar 15 '21 at 16:11
avatar  of Enselic
Enselic

I just run bat --style=plain

comparison between regular and plain style: https://i.imgur.com/DMtqsBp.png

1
Answered Mar 16 '21 at 08:54
avatar  of pentago
pentago

I bet you get numbers also with plain cat? I suspect your shell is adding the numbers for any output.

In any case, I would be grateful if you could provide the output of bat --diagnostic.

1
Answered Mar 16 '21 at 17:18
avatar  of Enselic
Enselic

No line numbers were added with regular cat.

Here's the diagnostic output:

Software version

bat 0.18.0

Operating system

Darwin 20.3.0

Command-line

bat --diagnostic 

Environment variables

SHELL=/usr/local/bin/zsh
PAGER=less
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>

Config file

Could not read contents of '/Users/dzhi/.config/bat/config': No such file or directory (os error 2).

Compile time information

  • Profile: release
  • Target triple: x86_64-apple-darwin
  • Family: unix
  • OS: macos
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2,sse3,ssse3
  • Host: x86_64-apple-darwin

Less version

> less --version 
less 487 (POSIX regular expressions)
Copyright (C) 1984-2016  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
1
Answered Mar 16 '21 at 18:46
avatar  of pentago
pentago

Interesting. Some follow up questions. Do you get the same line numbering problems if you

  1. use native macOS version of zsh, i.e. SHELL=/bin/zsh
  2. show the file with pure less?
  3. try to reproduce with a newly created user on that machine?
1
Answered Mar 16 '21 at 19:29
avatar  of Enselic
Enselic