bat
bat copied to clipboard
Using `-S` inside `bat` does not chop long lines
What steps will reproduce the bug?
bat file_with_long_lines.txt
What happens?
If I open a file with long lines, in my case a csv file with long lines, I see that the lines are wrapped. Pressing -S in bat claims Chop long lines but the lines stay wrapped.
But if I invoke bat -S file_with_long_lines.txt then the lines are not wrapped.
What did you expect to happen instead?
I would expect that pressing -S multiple times inside bat would toggle on and off line wrapping.
How did you install bat?
cargo install --force bat
bat version and environment
Software version
bat 0.24.0
Operating system
Linux 3.10.0-1160.62.1.el7.x86_64
Command-line
bat --diagnostic
Environment variables
SHELL=/bin/bash
PAGER=<not set>
LESS=-XQRSia
LANG=en_CA.UTF-8
LC_ALL=en_CA.UTF-8
BAT_PAGER=<not set>
BAT_PAGING=<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=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>
System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
Could not read contents of '$HOME/.config/bat/config': No such file or directory (os error 2).
Custom assets metadata
Could not read contents of '$HOME/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'$HOME/.cache/bat' not found
Compile time information
- Profile: release
- Target triple: x86_64-unknown-linux-gnu
- Family: unix
- OS: linux
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2
- Host: x86_64-unknown-linux-gnu
Less version
> less --version
less 551 (PCRE2 regular expressions)
Copyright (C) 1984-2019 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.
Home page: http://www.greenwoodsoftware.com/less
I think I know what is happening. When calling bat file_with_long_lines.txt, the output generated by bat is line wrapped then passed to my pager which is less. When I type -S which is actually handled by the pager, less toggles line wrapping but since bat outputed a line wrapped content, toggling line wrapping in less has no effect.
How should I call bat to be able to toggle line wrapping?
If it's not too much trouble, would you be able to add a screenshot to demonstrate?
Line chopping involves some complicated interactions between bat and less, and either one of them could be doing the wrapping. If the sidebar is enabled in bat and the text overflows the line into the sidebar area, bat isn't making any attempt to wrap the line. In that case, it may be less not receiving the -S flag from bat.
bat file.csv
Pressing -S multiple times I still get the following:
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: delme.csv
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ lr=1.0e-4_e=1/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01,4
│ 0.29,40.14,39.56,42.01,41.13,39.23,38.35,42.28,41.46,40.73,39.80,40.76,39.70,41.72,40.56,40.90,40.40,40.62,39.53,43.28,42.01,43.49,43.95,42.43,42.55,39.13,37
│ .94,41.82,40.61,41.80,41.32,40.25,39.27,40.35,39.04,43.13,42.10,39.44,39.18,42.84,42.85,42.02,41.23,41.82,40.14,40.34,38.64,42.11,41.79,44.25,43.41,42.36,41.
│ 32,2024-01-26T06:07:38
2 │ lr=1.0e-4_e=1/001,42.23,42.24,44.28,44.43,42.30,42.37,43.59,43.62,44.90,45.56,42.12,42.24,42.53,42.52,42.48,42.51,40.32,40.31,41.55,41.42,41.75,41.84,41.31,4
│ 1.43,40.55,40.67,42.07,42.05,39.27,39.20,42.43,42.47,41.01,40.95,41.01,40.97,41.72,41.67,41.00,40.99,41.08,41.09,42.87,43.18,44.59,44.37,42.38,42.55,38.88,39
│ .60,42.11,41.95,41.49,41.59,39.96,40.10,40.26,40.32,43.55,43.80,40.02,39.86,43.40,43.40,41.97,41.75,42.24,42.10,40.65,40.81,41.93,42.21,,41.08,41.09,41.84,20
│ 24-02-20T15:08:58
3 │ lr=1.0e-4_e=1/002,42.11,42.22,44.68,44.76,42.36,42.34,43.63,43.72,45.05,45.06,43.58,43.97,42.63,42.72,42.71,42.70,40.36,40.35,41.63,41.62,41.96,41.97,41.27,4
│ 1.37,40.44,40.45,42.22,42.13,39.23,39.32,42.48,42.52,41.07,41.09,40.95,40.96,41.77,41.74,41.12,41.24,42.36,43.40,43.25,43.11,44.90,45.08,42.83,42.65,39.78,39
│ .81,42.49,42.61,42.14,42.33,40.05,40.28,40.32,40.04,43.87,43.89,39.79,39.74,42.94,42.99,42.15,42.40,41.43,41.37,40.78,40.70,42.38,42.66,,43.25,43.11,42.09,20
│ 24-02-20T15:21:35
4 │ lr=1.0e-4_e=1/003,42.12,42.22,44.53,44.68,42.37,42.61,43.67,43.85,44.82,45.01,43.61,43.47,42.99,44.58,42.75,43.02,40.44,40.70,41.57,41.69,41.97,41.85,41.16,4
│ 1.39,40.49,40.57,42.19,42.28,39.28,39.35,42.41,42.55,41.12,41.03,40.90,41.02,41.57,41.67,41.06,41.01,42.25,42.61,43.64,43.94,45.06,44.32,42.54,42.44,40.14,40
│ .02,42.64,42.81,41.98,41.90,40.38,40.44,39.83,40.09,43.41,43.67,39.94,39.79,43.05,43.18,42.02,41.32,41.26,41.82,40.62,40.37,42.39,42.30,,45.06,44.32,42.12,20
│ 24-02-20T15:33:11
5 │ lr=1.0e-4_e=1/004,42.24,42.13,44.65,44.55,42.36,42.35,43.67,43.75,44.93,45.01,43.64,43.64,43.22,43.38,43.21,43.92,40.59,40.60,41.65,41.52,42.04,42.25,41.19,4
│ 1.22,40.46,40.43,42.03,42.15,39.32,39.38,42.43,42.46,40.89,40.97,41.10,41.08,41.84,41.72,41.11,41.13,42.90,43.02,43.63,43.40,46.46,46.77,42.30,42.11,39.80,39
│ .93,42.71,42.23,41.64,42.13,39.72,40.11,40.09,40.21,43.48,43.37,40.22,40.01,43.47,43.46,41.70,41.55,41.37,41.34,40.55,40.44,42.58,42.33,,42.30,42.11,42.10,20
│ 24-02-20T15:48:35
6 │ lr=1.0e-4_e=128/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01
│ ,40.29,40.14,39.56,42.01,41.13,39.23,38.35,42.28,41.46,40.73,39.80,40.76,39.70,41.72,40.56,40.90,40.40,40.62,39.53,43.28,42.01,43.49,43.95,42.43,42.55,39.13,
│ 37.94,41.82,40.61,41.80,41.32,40.25,39.27,40.35,39.04,43.13,42.10,39.44,39.18,42.84,42.85,42.02,41.23,41.82,40.14,40.34,38.64,42.11,41.79,44.25,43.41,42.36,4
│ 1.32,2024-01-26T06:07:38
7 │ lr=1.0e-4_e=128/001,41.56,35.17,43.40,36.76,41.83,34.22,43.04,36.10,59.13,93.16,41.62,36.15,42.27,37.51,42.33,36.67,39.91,35.12,41.15,35.26,41.27,34.97,40.96
│ ,34.99,40.22,35.33,41.52,35.71,38.94,30.52,41.72,34.56,40.49,33.61,40.34,33.74,41.17,35.25,40.49,34.15,42.14,38.27,42.62,36.60,44.14,38.97,42.26,36.53,39.08,
│ 34.24,41.56,35.10,41.06,35.27,39.79,34.50,40.07,35.14,43.04,36.34,38.73,30.79,42.97,35.89,41.78,34.66,41.15,34.04,39.97,34.85,41.22,35.67,,42.14,38.27,39.34,
│ 2024-02-20T15:14:39
8 │ lr=1.0e-4_e=128/002,41.54,35.92,44.02,37.34,41.94,35.43,43.09,36.89,58.02,49.69,51.57,93.81,42.32,37.54,42.26,37.07,40.25,35.36,41.10,35.71,41.51,35.87,40.81
│ ,35.36,40.38,35.82,41.84,36.11,38.73,31.50,41.97,35.53,40.48,34.12,40.49,34.47,41.15,35.23,40.50,34.77,51.95,99.33,43.67,39.35,43.93,37.49,42.58,36.19,39.41,
│ 33.71,41.45,35.76,41.49,35.25,39.44,34.23,39.95,35.41,43.41,35.35,38.75,31.14,42.99,35.79,41.30,35.77,41.03,34.02,39.77,34.50,42.03,34.98,,43.67,39.35,40.84,
│ 2024-02-20T19:59:50
9 │ lr=1.0e-4_e=128/003,41.99,36.40,44.05,36.76,41.62,33.84,42.93,35.68,56.68,42.21,51.84,46.04,56.99,94.09,42.52,37.19,40.34,35.50,40.82,34.93,41.38,34.29,40.88
│ ,34.50,40.18,34.79,41.86,34.89,38.58,30.71,41.77,34.59,40.14,33.53,40.16,33.53,41.17,35.42,40.63,33.98,50.94,39.14,58.09,99.27,45.50,41.06,42.12,36.92,40.08,
│ 34.10,40.20,34.68,41.31,33.93,39.96,34.17,38.94,33.90,42.93,34.90,38.64,30.93,43.50,34.99,40.96,34.18,41.26,33.79,39.62,34.21,41.21,35.18,,45.50,41.06,41.03,
│ 2024-02-20T23:43:20
10 │ lr=1.0e-4_e=128/004,43.31,39.39,43.00,37.48,41.08,34.61,42.50,36.59,54.93,42.28,49.64,40.20,57.46,49.73,74.44,93.22,39.76,36.19,40.22,35.39,40.68,35.23,40.04
│ ,34.76,39.53,35.43,41.12,35.63,37.66,31.73,40.84,35.12,39.49,34.49,39.34,34.78,40.57,36.42,39.89,34.60,49.57,39.64,54.12,42.62,78.41,99.48,42.54,38.18,39.85,
│ 34.99,39.95,35.19,40.78,35.53,39.28,34.38,39.62,36.22,42.31,34.80,37.36,31.26,41.41,35.30,39.74,35.54,39.67,35.45,39.10,35.38,40.89,35.99,,42.54,38.18,41.95,
│ 2024-02-21T04:26:24
bat -S file.csv
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: delme.csv
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ lr=1.0e-4_e=1/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01,>
2 │ lr=1.0e-4_e=1/001,42.23,42.24,44.28,44.43,42.30,42.37,43.59,43.62,44.90,45.56,42.12,42.24,42.53,42.52,42.48,42.51,40.32,40.31,41.55,41.42,41.75,41.84,41.31,>
3 │ lr=1.0e-4_e=1/002,42.11,42.22,44.68,44.76,42.36,42.34,43.63,43.72,45.05,45.06,43.58,43.97,42.63,42.72,42.71,42.70,40.36,40.35,41.63,41.62,41.96,41.97,41.27,>
4 │ lr=1.0e-4_e=1/003,42.12,42.22,44.53,44.68,42.37,42.61,43.67,43.85,44.82,45.01,43.61,43.47,42.99,44.58,42.75,43.02,40.44,40.70,41.57,41.69,41.97,41.85,41.16,>
5 │ lr=1.0e-4_e=1/004,42.24,42.13,44.65,44.55,42.36,42.35,43.67,43.75,44.93,45.01,43.64,43.64,43.22,43.38,43.21,43.92,40.59,40.60,41.65,41.52,42.04,42.25,41.19,>
6 │ lr=1.0e-4_e=128/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.0>
7 │ lr=1.0e-4_e=128/001,41.56,35.17,43.40,36.76,41.83,34.22,43.04,36.10,59.13,93.16,41.62,36.15,42.27,37.51,42.33,36.67,39.91,35.12,41.15,35.26,41.27,34.97,40.9>
8 │ lr=1.0e-4_e=128/002,41.54,35.92,44.02,37.34,41.94,35.43,43.09,36.89,58.02,49.69,51.57,93.81,42.32,37.54,42.26,37.07,40.25,35.36,41.10,35.71,41.51,35.87,40.8>
9 │ lr=1.0e-4_e=128/003,41.99,36.40,44.05,36.76,41.62,33.84,42.93,35.68,56.68,42.21,51.84,46.04,56.99,94.09,42.52,37.19,40.34,35.50,40.82,34.93,41.38,34.29,40.8>
10 │ lr=1.0e-4_e=128/004,43.31,39.39,43.00,37.48,41.08,34.61,42.50,36.59,54.93,42.28,49.64,40.20,57.46,49.73,74.44,93.22,39.76,36.19,40.22,35.39,40.68,35.23,40.0>
11 │ lr=1.0e-4_e=16/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01>
12 │ lr=1.0e-4_e=16/001,41.56,41.21,43.40,42.67,41.83,41.19,43.04,42.27,59.13,78.25,41.62,40.93,42.27,41.69,42.33,41.70,39.91,39.44,41.15,40.34,41.27,40.75,40.96>
13 │ lr=1.0e-4_e=16/002,41.54,40.71,44.02,43.26,41.94,41.22,43.09,41.88,58.02,59.42,51.57,76.72,42.32,41.63,42.26,41.61,40.25,39.54,41.10,40.37,41.51,41.00,40.81>
14 │ lr=1.0e-4_e=16/003,41.99,42.02,44.05,43.26,41.62,41.01,42.93,42.52,56.68,55.57,51.84,53.31,56.99,75.39,42.52,41.63,40.34,39.65,40.82,40.26,41.38,40.68,40.88>
15 │ lr=1.0e-4_e=16/004,43.31,43.35,43.00,42.88,41.08,40.97,42.50,42.61,54.93,54.79,49.64,49.50,57.46,57.39,74.44,76.10,39.76,39.77,40.22,40.18,40.68,40.57,40.04>
16 │ lr=1.0e-4_e=2/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01,>
17 │ lr=1.0e-4_e=2/001,42.07,42.07,44.41,44.41,42.26,42.26,43.63,43.63,47.45,47.45,42.25,42.25,42.67,42.67,42.72,42.72,40.42,40.42,41.63,41.63,41.93,41.93,41.36,>
18 │ lr=1.0e-4_e=2/002,42.06,41.98,44.70,44.65,42.48,42.39,43.64,43.69,47.36,47.41,45.92,46.11,42.78,42.76,42.58,42.62,40.43,40.40,41.66,41.66,42.01,41.94,41.39,>
19 │ lr=1.0e-4_e=2/003,42.25,42.27,44.37,44.37,42.40,42.46,43.75,43.71,47.62,47.45,45.83,45.77,46.01,46.32,42.95,43.04,40.81,40.90,41.69,41.75,42.09,42.02,41.35,>
20 │ lr=1.0e-4_e=2/004,42.30,42.25,44.39,44.56,42.49,42.17,43.73,43.70,47.52,47.26,45.81,45.52,45.92,46.25,43.06,46.11,40.96,40.95,41.72,41.63,41.94,41.92,41.27,>
21 │ lr=1.0e-4_e=32/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01>
22 │ lr=1.0e-4_e=32/001,41.56,40.20,43.40,41.81,41.83,40.41,43.04,41.11,59.13,92.57,41.62,39.96,42.27,40.91,42.33,40.68,39.91,38.38,41.15,39.44,41.27,39.68,40.96>
23 │ lr=1.0e-4_e=32/002,41.54,39.96,44.02,42.45,41.94,40.23,43.09,41.27,58.02,58.68,51.57,93.00,42.32,40.75,42.26,40.77,40.25,38.83,41.10,39.77,41.51,40.22,40.81>
24 │ lr=1.0e-4_e=32/003,41.99,41.51,44.05,42.38,41.62,39.88,42.93,41.30,56.68,52.52,51.84,53.09,56.99,93.03,42.52,40.80,40.34,38.93,40.82,39.43,41.38,39.67,40.88>
25 │ lr=1.0e-4_e=32/004,43.31,43.93,43.00,42.13,41.08,40.24,42.50,41.90,54.93,52.89,49.64,47.95,57.46,57.40,74.44,92.17,39.76,39.22,40.22,39.48,40.68,40.05,40.04>
26 │ lr=1.0e-4_e=4/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01,>
27 │ lr=1.0e-4_e=4/001,42.00,42.05,44.27,44.27,42.33,42.19,43.49,43.44,49.74,51.49,42.21,42.19,42.62,42.55,42.62,42.69,40.40,40.27,41.49,41.43,41.71,41.53,41.45,>
28 │ lr=1.0e-4_e=4/002,42.00,41.91,44.51,44.41,42.35,42.06,43.53,43.54,49.86,49.49,44.91,49.27,42.70,42.62,42.72,42.59,40.41,40.50,41.64,41.29,42.00,41.76,41.28,>
29 │ lr=1.0e-4_e=4/003,42.50,42.50,44.55,44.55,42.31,42.31,43.53,43.53,49.10,49.10,44.98,44.98,49.94,49.94,43.03,43.03,40.90,40.90,41.66,41.66,41.95,41.95,41.41,>
30 │ lr=1.0e-4_e=4/004,42.41,42.91,44.43,44.44,42.29,42.07,43.46,43.50,49.12,48.70,45.14,44.63,49.75,49.96,43.11,49.64,41.00,41.13,41.57,41.44,41.99,41.92,41.38,>
31 │ lr=1.0e-4_e=64/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01>
32 │ lr=1.0e-4_e=64/001,41.56,38.38,43.40,40.38,41.83,38.24,43.04,39.60,59.13,93.47,41.62,38.82,42.27,39.81,42.33,39.31,39.91,37.36,41.15,37.87,41.27,38.10,40.96>
33 │ lr=1.0e-4_e=64/002,41.54,38.78,44.02,40.38,41.94,38.73,43.09,39.94,58.02,54.38,51.57,93.92,42.32,39.65,42.26,39.50,40.25,37.73,41.10,38.29,41.51,38.64,40.81>
34 │ lr=1.0e-4_e=64/003,41.99,39.51,44.05,39.57,41.62,36.90,42.93,39.15,56.68,47.41,51.84,49.96,56.99,94.20,42.52,39.25,40.34,37.28,40.82,37.50,41.38,37.44,40.88>
35 │ lr=1.0e-4_e=64/004,43.31,42.55,43.00,40.81,41.08,38.56,42.50,40.40,54.93,48.79,49.64,44.78,57.46,53.96,74.44,93.29,39.76,38.11,40.22,38.35,40.68,38.54,40.04>
36 │ lr=1.0e-4_e=8/000,42.10,41.15,44.25,44.01,42.44,41.65,43.51,42.43,43.10,42.38,41.86,41.10,42.39,41.88,42.44,41.87,39.96,39.24,41.27,40.50,41.62,40.98,41.01,>
37 │ lr=1.0e-4_e=8/001,41.56,41.59,43.40,43.28,41.83,41.85,43.04,42.94,59.13,59.59,41.62,41.60,42.27,42.28,42.33,42.32,39.91,39.90,41.15,41.06,41.27,41.24,40.96,>
38 │ lr=1.0e-4_e=8/002,41.54,41.44,44.02,43.94,41.94,41.90,43.09,42.95,58.02,58.35,51.57,57.46,42.32,42.29,42.26,42.29,40.25,40.26,41.10,41.02,41.51,41.29,40.81,>
39 │ lr=1.0e-4_e=8/003,42.08,42.08,44.16,44.14,41.88,41.73,43.13,43.00,57.02,56.79,51.62,51.83,52.15,56.12,42.63,42.46,40.71,40.48,41.11,40.90,41.53,41.51,41.16,>
40 │ lr=1.0e-4_e=8/004,42.95,42.90,43.86,43.82,41.68,41.53,43.06,42.99,55.98,55.92,50.34,50.25,52.29,52.41,55.69,57.38,40.45,40.46,40.86,40.79,41.48,41.43,40.68,
I am having the same problem as @SamuelLarkin - less as my pager, -S not working.
Admittedly I've implemented much greater bat configuration than @SamuelLarkin, so maybe I borked something. But I swear I did not use to have this problem.
Note that invoking less -S directly yield the desired wrap-toggling behavior.
Software version
bat 0.24.0
Operating system
macOS 14.3.1 (Darwin 23.3.0)
Command-line
bat --diagnostic
Environment variables
SHELL=/bin/zsh
PAGER=<not set>
LESS=<not set>
LANG=en_US.UTF-8
LC_ALL=<not set>
BAT_PAGER='less --chop-long-lines --RAW-CONTROL-CHARS --header=1 --jump-target=3 --line-num-width=0 --LONG-PROMPT --no-number-headers --shift=4 --status-column --use-color --color=HGk --color=NGk'
BAT_PAGING=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS='--italic-text=always --pager='\''less --chop-long-lines --RAW-CONTROL-CHARS --header=1 --jump-target=3 --line-num-width=0 --LONG-PROMPT --no-number-headers --shift=4 --status-column --use-color --color=HGk --color=NGk'\'' --style=changes,header-filename,rule,snip --theme=TwoDark --wrap=never'
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='sh -c '\''col -bx | bat --language=man --style=plain --theme=Monokai\ Extended'\'''
System Config file
Could not read contents of '/etc/bat/config': No such file or directory (os error 2).
Config file
Could not read contents of '$HOME/.config/bat/config': No such file or directory (os error 2).
Custom assets metadata
Could not read contents of '$HOME/.cache/bat/metadata.yaml': No such file or directory (os error 2).
Custom assets
'$HOME/.cache/bat' not found
Compile time information
- Profile: release
- Target triple: aarch64-apple-darwin
- Family: unix
- OS: macos
- Architecture: aarch64
- Pointer width: 64
- Endian: little
- CPU features: aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh
- Host: aarch64-apple-darwin
Less version
> less --version
less 643 (PCRE2 regular expressions)
Copyright (C) 1984-2023 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.
Home page: https://greenwoodsoftware.com/less
In the interest of linking issues, #2837 may be of minor relevance.
Actually, in investigating this further, I realized that less's --header option - which I specify in my BAT_PAGER - seems to disable -S.
@SamuelLarkin doesn't seem to be using that flag, but it may explain this issue in my case at least. I've opened an issue for it (gwsw/less#487).
I had the same problem with my default config, pressing -S doesn't do anything:
bat --pager='less +S' some_file
Maybe you just need to tell bat not to wrap lines, so that less can do the wrapping or chopping, that worked for me:
bat --wrap=never --pager='less +S' some_file
This way, bat doesn't do any wrapping, less does, and the wrapping can be turned off interactively by entering -S.