2018-10-21 13:43:56 +02:00
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global BufCreate .*\.\d+ %{
|
|
|
|
set-option buffer filetype troff
|
|
|
|
}
|
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=troff %{
|
2019-03-13 22:00:59 +01:00
|
|
|
require-module troff
|
|
|
|
}
|
|
|
|
|
2019-04-10 05:54:19 +02:00
|
|
|
hook -group troff-highlight global WinSetOption filetype=troff %{
|
|
|
|
add-highlighter window/troff ref troff
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/troff }
|
|
|
|
}
|
|
|
|
|
2019-03-13 22:00:59 +01:00
|
|
|
provide-module troff %{
|
|
|
|
|
2018-10-21 13:43:56 +02:00
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2023-04-04 10:22:46 +02:00
|
|
|
add-highlighter shared/troff regions
|
|
|
|
|
|
|
|
add-highlighter shared/troff/text default-region group
|
|
|
|
add-highlighter shared/troff/text/ regex '(^\.)?\\".*?\n' 0:comment
|
|
|
|
add-highlighter shared/troff/text/ regex '\\f[A-Z]' 0:attribute
|
|
|
|
add-highlighter shared/troff/text/ regex '\\fB(.+?)\\f[A-Z]' 1:+b
|
|
|
|
add-highlighter shared/troff/text/ regex '\\fI(.+?)\\f[A-Z]' 1:+i
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.[a-zA-Z]{1,2}\b' 0:meta
|
2023-07-30 09:47:10 +02:00
|
|
|
add-highlighter shared/troff/text/ regex '^\.(PSPIC|PDFPIC)\b' 0:meta
|
2023-04-04 10:22:46 +02:00
|
|
|
add-highlighter shared/troff/text/ regex '^\.\.$' 0:meta
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.TH\s+[^\n]+' 0:title
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.NH(\s+\d+(\s+\d+)?)?\s*\n' 0:header
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.SH(\s+\d+)?\s*\n' 0:header
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.IR\s+(\S+)' 1:+i
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.BR\s+(\S+)' 1:+b
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.I\s+([^\n]+)' 1:+i
|
|
|
|
add-highlighter shared/troff/text/ regex '^\.B\s+([^\n]+)' 1:+b
|
|
|
|
|
2023-07-30 09:47:10 +02:00
|
|
|
add-highlighter shared/troff/pic region '^\.PS\b' '^\.PE\b' group
|
|
|
|
add-highlighter shared/troff/pic/ regex '^(\.PS\b|\.PE\b)' 1:meta
|
2023-04-04 10:22:46 +02:00
|
|
|
add-highlighter shared/troff/pic/ regex '^(copy)\s+' 1:keyword
|
|
|
|
add-highlighter shared/troff/pic/ regex '\b(arc|arrow|box|circle|ellipse|line|move|spline)\b' 1:type
|
|
|
|
add-highlighter shared/troff/pic/ regex '\b(above|at|below|by|center|chop|dashed|diam|diameter|down|dotted|fill|from|ht|height|invis|left|ljust|rad|radius|right|rjust|solid|then|to|up|wid|width|with)\b' 1:attribute
|
|
|
|
add-highlighter shared/troff/pic/ regex '(\s+|\+|-|\*|/)(\d+(\.\d+)?)' 2:value
|
|
|
|
add-highlighter shared/troff/pic/ regex '"[^"]*"' 0:string
|
2019-03-13 22:00:59 +01:00
|
|
|
}
|