[bug] Bad highlighting from syntax/man.vim

5 views
Skip to first unread message

Franklin, Jason

unread,
Apr 15, 2020, 4:41:37 PM4/15/20
to vim...@googlegroups.com, gow...@gmail.com
Greetings:

Some man page headers and footers are not highlighted properly. Examples
on Debian 10 include "man last" and "man ufw".

This commit changes the highlighting rules to always highlight the first
and last lines, regardless of their form. This means that man pages
that look like (in the case of "man last")...

LAST, LASTB(1) User Commands LAST, LASTB(1)

... will still be highlighted correctly. Same goes for the footer.

diff --git a/runtime/syntax/man.vim b/runtime/syntax/man.vim
index 77675c5d2..5bdba8621 100644
--- a/runtime/syntax/man.vim
+++ b/runtime/syntax/man.vim
@@ -3,7 +3,7 @@
" Maintainer: SungHyun Nam <gow...@gmail.com>
" Previous Maintainer: Gautam H. Mudunuri <gmud...@informatica.com>
" Version Info:
-" Last Change: 2015 Nov 24
+" Last Change: 2020 Apr 15

" Additional highlighting by Johannes Tanzler <johannes...@aon.at>:
" * manSubHeading
@@ -18,8 +18,11 @@ endif
runtime! syntax/ctrlh.vim

syn case ignore
+
+syn match manHeader '\%1l.*'
+exe 'syn match manFooter ''\%' . line('$') . 'l.*'''
+
syn match manReference "\f\+([1-9][a-z]\=)"
-syn match manTitle "^\f\+([0-9]\+[a-z]\=).*"
syn match manSectionHeading "^[a-z][a-z -]*[a-z]$"
syn match manSubHeading "^\s\{3\}[a-z][a-z -]*[a-z]$"
syn match manOptionDesc "^\s*[+-][a-z0-9]\S*"
@@ -36,7 +39,9 @@ endif
" Define the default highlighting.
" Only when an item doesn't have highlighting yet

-hi def link manTitle Title
+hi def link manHeader Title
+hi def link manFooter PreProc
+
hi def link manSectionHeading Statement
hi def link manOptionDesc Constant
hi def link manLongOptionDesc Constant


Thanks!

--
Jason Franklin
Reply all
Reply to author
Forward
0 new messages