Need help getting foot terminal to display man pages with syntax highlighting

Hi,

I have recently been messing around with the foot terminal emulator and noticed that man pages are not displayed with syntax highlighting (honestly shout out to the KDE team for making Konsole so feature rich). I have been looking around online for some solutions and nothing seems to work for me.

export MANPAGER="less -R --use-color -Dd+r -Du+b"
 man() {
    LESS_TERMCAP_md=$'\e[01;31m' \
    LESS_TERMCAP_me=$'\e[0m' \
    LESS_TERMCAP_se=$'\e[0m' \
    LESS_TERMCAP_so=$'\e[01;44;33m' \
    LESS_TERMCAP_ue=$'\e[0m' \
    LESS_TERMCAP_us=$'\e[01;32m' \
    command man "$@"
}

These are some of the commands I have tried but they seem to only add color to the information panel at the bottom of the terminal as seen below in teal. Both commands listed above only change that field but don’t highlight anything within the manpage itself.

I know this can be done with packages like bat & bat-extras but I would like to see if this is something I can solve with the tools my system already has instead of throwing another package at it.

If anyone has any ideas please let me know!

Thanks!

Hi @Joe_Mama ,
Have you tried bat ?
man ls | bat -l man

more HERE

Edit:
television is much better.
sudo mandb # may be missing to generate man pages
tv update-channels
Here is a custmized ~/.config/television/cable/mman-pages.toml

[metadata]
name = "mman-pages"
Description = "Browse and preview sytem manual pages"
requirements = [ "apropos", "man", "col",]

[source]
command = "apropos ."

[preview]
command = "man '{0}' | bat --color=always --style=snip -l bat"
env = { BAT_THEME = "ansi" }

[ui]
layout = "landscape"

[keybindings]
ctrl-b = "actions:bat"
ctrl-n = "actions:nvim"

#[preview.env]
#NAMWIDTH = "80"

[actions.bat]
Description = "Pipe to bat"
command = "man '{0}' | bat -l man"
mode = "fork"

[actions.nvim]
Description = "Pipe to nvim"
command = "man '{0}' | nvim"
mode = "fork"

[ui.preview_panel]
header = "{0}"

tv mman-pages


You may call nvim by ctrl/n

I use bat with this function in my .bashrc:

man() {
    command man "$@" | col -bx | bat --language=man --paging=always
}

and these lines:


--style=plain
--wrap=character

in ~/.config/bat/config.

Regarding less, that’s what I have in my .zshrc:

export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export MANROFFOPT=-c

You probably need the last export option to have it working.

Yes, I did try it with bat, I was just trying to see if i could get it to work without needing to install another package like bat/ batman. With that said though i gotta say tv mman-pages looks pretty sweet … and i do already have tv on my system… might need to give that a go.

This is it! Adding that to my .bashrc did the trick! Thank you!

Glad I was able to help.