8

I like the man command's status prompt to be customized. The default as picked from its own man page is like this,

Manual page name(sec) line x

But, having it show me the percentage of contents read is my preference. So I set the environment variable that controls the prompt, MANLESS as,

export MANLESS='?pt%pt \%: '

The prompt is empty. I put -P in the front as,

export MANLESS='-P?pt%pt \%: '

No progress, now the prompt only contains -P. So, I directly set it for every invocation using the -r option,

man -r '?pt%pt \%: ' less

That too didn't help. But, this same prompt when set to LESS env. variable as

export LESS="-P?pt%pt \%"

Every direct invocation of less is showing the desired prompt as

x %.

It is only when less pager is called through man, it does not work.

1
  • There is another thread here that addresses the same issue.... Commented Nov 30, 2024 at 2:18

1 Answer 1

21

less can only show the position in the document as a percentage if it knows how long the document is. When it’s used to display man pages, the text is piped to it, so it doesn’t know the length of the document initially – you need to scroll to the end of the document so that less knows how long it is.

You can automate this by telling less to scroll to the end and back to the beginning:

LESS=+Gg man less

It’s best not to set this globally, it will cause less to take a while to start when viewing large files and it will break its functionality when viewing input that is slowly piped into it or is infinite. You can use MANPAGER instead:

export MANPAGER="less +Gg"
man less

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.