on master help sign in
Highlight C code in all man pages sections
commit41e857ea1650e216932fca057b46fed5566e26a2 authorKeith Hall <kingkeith+github@gmail.com> dateSat 17 Oct 2020, 18:45 (6 years ago) parent5b2da2b
4 files changed+37−29
assets/syntaxes/02_Extra/Manpage.sublime-syntax+5−1 assets/syntaxes/02_Extra/syntax_test_man.man+4 tests/syntax-tests/highlighted/Manpage/bat-0.16.man+27−27 tests/syntax-tests/highlighted/Manpage/select-2.man+1−1
assets/syntaxes/02_Extra/Manpage.sublime-syntax+5−1
@@ -83,6 +83,7 @@ contexts:
8383 - match: ''
8484 pop: true
8585 - include: function-call
86+ - include: c-code
8687
8788 expect-command-line-option:
8889 - match: '[A-Za-z0-9-]+'
@@ -127,9 +128,12 @@ contexts:
127128 - match: '$|(?=[],]|{{command_line_option}})'
128129 pop: true
129130
130− synopsis:
131+ c-code:
131132 - match: '^(?=\s+(?:#include|/\*))'
132133 push: scope:source.c
134+
135+ synopsis:
136+ - include: c-code
133137 - match: \[
134138 scope: punctuation.section.brackets.begin.man
135139 push: command-line-option-or-pipe
assets/syntaxes/02_Extra/syntax_test_man.man+4
@@ -123,3 +123,7 @@ OPTIONS
123123# ^^^ variable.parameter
124124# ^^ - variable
125125 output NUM (default 3) lines of copied context
126+
127+EXAMPLE
128+ #include <stdio.h>
129+# ^^^^^^^^ source meta.preprocessor.include keyword.control.import.include
tests/syntax-tests/highlighted/Manpage/bat-0.16.man+27−27
@@ -1,7 +1,7 @@
1−BAT(1) General Commands Manual BAT(1)
1+BAT(1) General Commands Manual BAT(1)
22
33NAME
4− bat - a cat(1) clone with syntax highlighting and Git integration.
4+ bat - a cat(1) clone with syntax highlighting and Git integration.
55
66USAGE
77 bat [OPTIONS] [FILE]...
@@ -28,19 +28,19 @@
2828 values can be specified as either '--language value', '--lan‐
2929 guage=value', '-l value' or '-lvalue'.
3030
31− -A, --show-all
31+ -A, --show-all
3232
3333 Show non-printable characters like space, tab or newline. Use
3434 '--tabs' to control the width of the tab-placeholders.
3535
36− -p, --plain
36+ -p, --plain
3737
3838 Only show plain style, no decorations. This is an alias for
39− '--style=plain'. When '-p' is used twice ('-pp'), it also dis‐
39+ '--style=plain'. When '-p' is used twice ('-pp'), it also dis‐
4040 ables automatic paging (alias for '--style=plain
41− --pager=never').
41+ --pager=never').
4242
43− -l, --language <language>
43+ -l, --language <language>
4444
4545 Explicitly set the language for syntax highlighting. The lan‐
4646 guage can be specified as a name (like 'C++' or 'LaTeX') or pos‐
@@ -65,54 +65,54 @@
6565 --highlight-line 40:
6666 highlights lines 40 to the end of the file
6767
68− --tabs <T>
68+ --tabs <T>
6969
7070 Set the tab width to T spaces. Use a width of 0 to pass tabs
7171 through directly
7272
73− --wrap <mode>
73+ --wrap <mode>
7474
7575 Specify the text-wrapping mode (*auto*, never, character). The
7676 '--terminal-width' option can be used in addition to control the
7777 output width.
7878
79− --terminal-width <width>
79+ --terminal-width <width>
8080
8181 Explicitly set the width of the terminal instead of determining
8282 it automatically. If prefixed with '+' or '-', the value will be
8383 treated as an offset to the actual terminal width. See also:
8484 '--wrap'.
8585
86− -n, --number
86+ -n, --number
8787
8888 Only show line numbers, no other decorations. This is an alias
89− for '--style=numbers'
89+ for '--style=numbers'
9090
91− --color <when>
91+ --color <when>
9292
9393 Specify when to use colored output. The automatic mode only en‐
9494 ables colors if an interactive terminal is detected. Possible
9595 values: *auto*, never, always.
9696
97− --italic-text <when>
97+ --italic-text <when>
9898
9999 Specify when to use ANSI sequences for italic text in the out‐
100100 put. Possible values: always, *never*.
101101
102− --decorations <when>
102+ --decorations <when>
103103
104104 Specify when to use the decorations that have been specified via
105105 '--style'. The automatic mode only enables decorations if an in‐
106106 teractive terminal is detected. Possible values: *auto*, never,
107107 always.
108108
109− -f, --force-colorization
109+ -f, --force-colorization
110110
111− Alias for '--decorations=always --color=always'. This is useful
111+ Alias for '--decorations=always --color=always'. This is useful
112112 if the output of bat is piped to another program, but you want
113113 to keep the colorization/decorations.
114114
115− --paging <when>
115+ --paging <when>
116116
117117 Specify when to use the pager. To disable the pager, use '--pag‐
118118 ing=never' or its alias, -P. To disable the pager permanently,
@@ -120,7 +120,7 @@
120120 used, see the '--pager' option. Possible values: *auto*, never,
121121 always.
122122
123− --pager <command>
123+ --pager <command>
124124
125125 Determine which pager is used. This option will override the
126126 PAGER and BAT_PAGER environment variables. The default pager is
@@ -135,24 +135,24 @@
135135 '*.build:Python'. To highlight files named '.myignore' with the
136136 Git Ignore syntax, use -m '.myignore:Git Ignore'.
137137
138− --theme <theme>
138+ --theme <theme>
139139
140140 Set the theme for syntax highlighting. Use '--list-themes' to
141141 see all available themes. To set a default theme, add the
142− '--theme="..."' option to the configuration file or export the
142+ '--theme="..."' option to the configuration file or export the
143143 BAT_THEME environment variable (e.g.: export BAT_THEME="...").
144144
145145 --list-themes
146146
147147 Display a list of supported themes for syntax highlighting.
148148
149− --style <style-components>
149+ --style <style-components>
150150
151151 Configure which elements (line numbers, file headers, grid bor‐
152152 ders, Git modifications, ..) to display in addition to the file
153153 contents. The argument is a comma-separated list of components
154154 to display (e.g. 'numbers,changes,grid') or a pre-defined style
155− ('full'). To set a default style, add the '--style=".."' option
155+ ('full'). To set a default style, add the '--style=".."' option
156156 to the configuration file or export the BAT_STYLE environment
157157 variable (e.g.: export BAT_STYLE=".."). Possible values: *auto*,
158158 full, plain, changes, header, grid, numbers, snip.
@@ -171,21 +171,21 @@
171171 --line-range 40:
172172 prints lines 40 to the end of the file
173173
174− -L, --list-languages
174+ -L, --list-languages
175175
176176 Display a list of supported languages for syntax highlighting.
177177
178− -u, --unbuffered
178+ -u, --unbuffered
179179
180180 This option exists for POSIX-compliance reasons ('u' is for 'un‐
181181 buffered'). The output is always unbuffered - this option is
182182 simply ignored.
183183
184− -h, --help
184+ -h, --help
185185
186186 Print this help message.
187187
188− -V, --version
188+ -V, --version
189189
190190 Show version information.
191191
tests/syntax-tests/highlighted/Manpage/select-2.man+1−1
@@ -1,4 +1,4 @@
1−SELECT(2) Linux Programmer's Manual SELECT(2)
1+SELECT(2) Linux Programmer's Manual SELECT(2)
22
33NAME
44 select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing