Making less look like most

Feb 22, 2011 11:27

Over at Debian User Forums there is a thread talking about terminal pagers
and in the course of the conversation I remembered two older posts in other
threads

1: Colorizing man pages using sed
http://forums.debian.net/viewtopic.php?f=8&t=56264&p=333838#p326833

2: Make less behave like most (gives less a most like status line)
http://forums.debian.net/viewtopic.php?f=3&t=52503&hilit=less+most+pager#p302324

Now if one combines these two posts one ends up with a script something like

#!/bin/sh
sed -r "s/(.)\x8\1/\x1b[0;33m\1\x1b[0m/g;s/\_\x8(.)/\x1b[1;33m\1\x1b[0m/g" |
less -GJx4P?f[%f]:[STDIN].?pB - [%pB\%]:\.\.\..

if one then issues the command

export MANPAGER='path/to/the/script'

one ends up with less doing its absolute best to look like most when
displaying man pages




a tmux session with most on the left and the above script on the right.

See also: http://forums.debian.net/viewtopic.php?f=20&t=57482

geek, less, most, linux, computers, pager, debian

Previous post Next post
Up