I want to view
man-pages in colour, preserving
nroff's bold and italic directives.
How would I edit a buffer's text and setup highlight regions:
manpage_bold: For all instances of
- Conceal / remove the final 2 characters, leaving only the first.
manpage_italic: For all instances of
- Conceal / remove the leading two characters, leaving only the last.
X is any character other than backspace.
This is achieved by telling
less to replace overstrikes that
nroff produces to indicate bold / italics with ANSI SGR colour codes.
vim to be able to do the analogous thing: view man pages with the original bold / italics by removing the overstrikes and setting up highlight regions.
What's an overstrike I hear you ask? *takes deep breath*
Unix is a venerable old operating system, dating from the times when teletypes hammered inked ribbon, imprint characters on paper.
Bold characters were printed by printing the character, backspacing, then printing the same character again - twice as much ink was impressed upon the paper.
Italic characters are indicated by printing an underscore (
_), backspace and then the character to be rendered. (source)
Over 40 years later,
man still uses
nroff to generate the text that is displayed from the
troff man page source file... and
nroff still uses overstriking to indicate boldface / italics.
GROFF_SGR=1 to produce ANSI SGR codes rather than overstrikes,
AnsiEsc is needed to display the output, and this doesn't work with
set ft=man syntax highlighting.