Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man: Commands aren't highlighted at all #2459

Closed
WhyNotHugo opened this issue Jan 27, 2023 · 3 comments · Fixed by #2461
Closed

man: Commands aren't highlighted at all #2459

WhyNotHugo opened this issue Jan 27, 2023 · 3 comments · Fixed by #2461
Assignees
Labels
bug Something isn't working

Comments

@WhyNotHugo
Copy link

What steps will reproduce the bug?

I'm using batas a man pager:

$ echo $MANPAGER
bat-for-man

$ cat $(which bat-for-man )
#!/bin/sh
#
# man(1) can use a custom pager, but will exec `MANPAGER` as-is (e.g.: it won't
# pass it to a shell) so using arguments isn't possible.

col -bx < "$1" | bat --language man -p

What happens?

On man pages listing commands, commands themselves are not highlighted.

I'll use sway(5) as an example. With bat:

image

What did you expect to happen instead?

Without bat:

image

How did you install bat?

Distribution packages (Alpine)

bat version and environment

Software version

bat 0.22.1

Operating system

Linux 6.1.8-0-edge

Command-line

bat --diagnostic 

Environment variables

SHELL=/bin/zsh
PAGER='bat -p'
LESS='-RX --mouse --quit-if-one-screen'
LANG=en_GB.UTF-8
LC_ALL=<not set>
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=/home/hugo/.config
XDG_CACHE_HOME=/home/hugo/.cache
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=bat-for-man

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/hugo/.config/bat/config': No such file or directory (os error 2).

Custom assets metadata

Could not read contents of '/home/hugo/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'/home/hugo/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-alpine-linux-musl
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-alpine-linux-musl

Less version

> less --version 
less 608 (POSIX regular expressions)
Copyright (C) 1984-2022  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
@WhyNotHugo WhyNotHugo added the bug Something isn't working label Jan 27, 2023
@WhyNotHugo
Copy link
Author

Here's another example where bat actually results in less highlighting that the man's default via less:

Without bat:

image

With bat:

image

@WhyNotHugo
Copy link
Author

I'm still seeing the same behaviour after #2461.

@WhyNotHugo
Copy link
Author

Never mind, I didn't install the built-from-source files properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants