Highlight C code in all man pages sections

This commit is contained in:
Keith Hall 2020-10-17 18:45:23 +03:00 committed by David Peter
parent 5b2da2b08d
commit 41e857ea16
4 changed files with 37 additions and 29 deletions

View File

@ -83,6 +83,7 @@ contexts:
- match: ''
pop: true
- include: function-call
- include: c-code
expect-command-line-option:
- match: '[A-Za-z0-9-]+'
@ -127,9 +128,12 @@ contexts:
- match: '$|(?=[],]|{{command_line_option}})'
pop: true
synopsis:
c-code:
- match: '^(?=\s+(?:#include|/\*))'
push: scope:source.c
synopsis:
- include: c-code
- match: \[
scope: punctuation.section.brackets.begin.man
push: command-line-option-or-pipe

View File

@ -123,3 +123,7 @@ OPTIONS
# ^^^ variable.parameter
# ^^ - variable
output NUM (default 3) lines of copied context
EXAMPLE
#include <stdio.h>
# ^^^^^^^^ source meta.preprocessor.include keyword.control.import.include

View File

@ -1,7 +1,7 @@
BAT(1) General Commands Manual BAT(1)
BAT(1) General Commands Manual BAT(1)
NAME
 bat - a cat(1) clone with syntax highlighting and Git integration.
 bat - a cat(1) clone with syntax highlighting and Git integration.
USAGE
 bat [OPTIONS] [FILE]...
@ -28,19 +28,19 @@
 values can be specified as either '--language value', '--lan
 guage=value', '-l value' or '-lvalue'.
 -A, --show-all
 -A, --show-all
 Show non-printable characters like space, tab or newline. Use
 '--tabs' to control the width of the tab-placeholders.
 -p, --plain
 -p, --plain
 Only show plain style, no decorations. This is an alias for
 '--style=plain'. When '-p' is used twice ('-pp'), it also dis
 '--style=plain'. When '-p' is used twice ('-pp'), it also dis
 ables automatic paging (alias for '--style=plain
 --pager=never').
 --pager=never').
 -l, --language <language>
 -l, --language <language>
 Explicitly set the language for syntax highlighting. The lan
 guage can be specified as a name (like 'C++' or 'LaTeX') or pos
@ -65,54 +65,54 @@
 --highlight-line 40:
 highlights lines 40 to the end of the file
 --tabs <T>
 --tabs <T>
 Set the tab width to T spaces. Use a width of 0 to pass tabs
 through directly
 --wrap <mode>
 --wrap <mode>
 Specify the text-wrapping mode (*auto*, never, character). The
 '--terminal-width' option can be used in addition to control the
 output width.
 --terminal-width <width>
 --terminal-width <width>
 Explicitly set the width of the terminal instead of determining
 it automatically. If prefixed with '+' or '-', the value will be
 treated as an offset to the actual terminal width. See also:
 '--wrap'.
 -n, --number
 -n, --number
 Only show line numbers, no other decorations. This is an alias
 for '--style=numbers'
 for '--style=numbers'
 --color <when>
 --color <when>
 Specify when to use colored output. The automatic mode only en
 ables colors if an interactive terminal is detected. Possible
 values: *auto*, never, always.
 --italic-text <when>
 --italic-text <when>
 Specify when to use ANSI sequences for italic text in the out
 put. Possible values: always, *never*.
 --decorations <when>
 --decorations <when>
 Specify when to use the decorations that have been specified via
 '--style'. The automatic mode only enables decorations if an in
 teractive terminal is detected. Possible values: *auto*, never,
 always.
 -f, --force-colorization
 -f, --force-colorization
 Alias for '--decorations=always --color=always'. This is useful
 Alias for '--decorations=always --color=always'. This is useful
 if the output of bat is piped to another program, but you want
 to keep the colorization/decorations.
 --paging <when>
 --paging <when>
 Specify when to use the pager. To disable the pager, use '--pag
 ing=never' or its alias, -P. To disable the pager permanently,
@ -120,7 +120,7 @@
 used, see the '--pager' option. Possible values: *auto*, never,
 always.
 --pager <command>
 --pager <command>
 Determine which pager is used. This option will override the
 PAGER and BAT_PAGER environment variables. The default pager is
@ -135,24 +135,24 @@
 '*.build:Python'. To highlight files named '.myignore' with the
 Git Ignore syntax, use -m '.myignore:Git Ignore'.
 --theme <theme>
 --theme <theme>
 Set the theme for syntax highlighting. Use '--list-themes' to
 see all available themes. To set a default theme, add the
 '--theme="..."' option to the configuration file or export the
 '--theme="..."' option to the configuration file or export the
 BAT_THEME environment variable (e.g.: export BAT_THEME="...").
 --list-themes
 Display a list of supported themes for syntax highlighting.
 --style <style-components>
 --style <style-components>
 Configure which elements (line numbers, file headers, grid bor
 ders, Git modifications, ..) to display in addition to the file
 contents. The argument is a comma-separated list of components
 to display (e.g. 'numbers,changes,grid') or a pre-defined style
 ('full'). To set a default style, add the '--style=".."' option
 ('full'). To set a default style, add the '--style=".."' option
 to the configuration file or export the BAT_STYLE environment
 variable (e.g.: export BAT_STYLE=".."). Possible values: *auto*,
 full, plain, changes, header, grid, numbers, snip.
@ -171,21 +171,21 @@
 --line-range 40:
 prints lines 40 to the end of the file
 -L, --list-languages
 -L, --list-languages
 Display a list of supported languages for syntax highlighting.
 -u, --unbuffered
 -u, --unbuffered
 This option exists for POSIX-compliance reasons ('u' is for 'un
 buffered'). The output is always unbuffered - this option is
 simply ignored.
 -h, --help
 -h, --help
 Print this help message.
 -V, --version
 -V, --version
 Show version information.

View File

@ -1,4 +1,4 @@
SELECT(2) Linux Programmer's Manual SELECT(2)
SELECT(2) Linux Programmer's Manual SELECT(2)
NAME
 select, pselect, FD_CLR, FD_ISSET, FD_SET, FD_ZERO - synchronous I/O multiplexing