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
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
add-highlighter shared/troff group
|
2021-02-25 15:16:17 +01:00
|
|
|
|
|
|
|
add-highlighter shared/troff/ regex '(^\.)?\\".*?\n' 0:comment
|
|
|
|
|
2018-10-21 13:43:56 +02:00
|
|
|
add-highlighter shared/troff/ regex '\\f[A-Z]' 0:attribute
|
|
|
|
add-highlighter shared/troff/ regex '\\fB(.+?)\\f[A-Z]' 1:+b
|
|
|
|
add-highlighter shared/troff/ regex '\\fI(.+?)\\f[A-Z]' 1:+i
|
|
|
|
|
|
|
|
add-highlighter shared/troff/ regex '^\.[a-zA-Z]{1,2}\b' 0:meta
|
2021-02-25 15:16:17 +01:00
|
|
|
add-highlighter shared/troff/ regex '^\.\.$' 0:meta
|
2018-10-21 13:43:56 +02:00
|
|
|
add-highlighter shared/troff/ regex '^\.TH\s+[^\n]+' 0:title
|
2022-12-30 21:45:17 +01:00
|
|
|
add-highlighter shared/troff/ regex '^\.NH(\s+\d+(\s+\d+)?)?\s*\n' 0:header
|
|
|
|
add-highlighter shared/troff/ regex '^\.SH(\s+\d+)?\s*\n' 0:header
|
2018-10-21 13:43:56 +02:00
|
|
|
add-highlighter shared/troff/ regex '^\.IR\s+(\S+)' 1:+i
|
|
|
|
add-highlighter shared/troff/ regex '^\.BR\s+(\S+)' 1:+b
|
|
|
|
add-highlighter shared/troff/ regex '^\.I\s+([^\n]+)' 1:+i
|
|
|
|
add-highlighter shared/troff/ regex '^\.B\s+([^\n]+)' 1:+b
|
|
|
|
|
2019-03-13 22:00:59 +01:00
|
|
|
}
|