2020-09-20 17:50:39 +00:00
.TH {{PROJECT_EXECUTABLE_UPPERCASE}} "1"
2018-08-27 20:57:47 +00:00
.SH NAME
2020-03-15 22:15:30 +00:00
{{PROJECT_EXECUTABLE}} \- a cat(1) clone with syntax highlighting and Git integration.
2018-08-27 20:57:47 +00:00
.SH "USAGE"
2020-03-15 22:15:30 +00:00
.IP "{{PROJECT_EXECUTABLE}} [OPTIONS] [FILE]..."
.IP "{{PROJECT_EXECUTABLE}} cache [CACHE-OPTIONS] [--build|--clear]
.SH DESCRIPTION
{{PROJECT_EXECUTABLE}} prints the syntax-highlighted content of a collection of FILEs to the
terminal. If no FILE is specified, or when FILE is '-', it reads from standard input.
{{PROJECT_EXECUTABLE}} supports a large number of programming and markup languages.
It also communicates with git(1) to show modifications with respect to the git index.
{{PROJECT_EXECUTABLE}} automatically pipes its output through a pager (by default: less).
Whenever the output of {{PROJECT_EXECUTABLE}} goes to a non-interactive terminal, i.e. when the
output is piped into another process or into a file, {{PROJECT_EXECUTABLE}} will act as a drop-in
replacement for cat(1) and fall back to printing the plain file contents.
2018-08-27 20:57:47 +00:00
.SH "OPTIONS"
2020-03-15 22:15:30 +00:00
General remarks: Command-line options like '-l'/'--language' that take values can be specified as
2019-08-15 19:57:32 +00:00
either '--language value', '--language=value', '-l value' or '-lvalue'.
.HP
2019-10-23 22:25:02 +00:00
\fB \- A\fR , \fB \- \- show\- all\fR
.IP
Show non\- printable characters like space, tab or newline. Use '\- \- tabs' to
control the width of the tab\- placeholders.
.HP
\fB \- p\fR , \fB \- \- plain\fR
.IP
Only show plain style, no decorations. This is an alias for
\& '\- \- style=plain'. When '\- p' is used twice ('\- pp'), it also disables
automatic paging (alias for '\- \- style=plain \fB \- \- pager\fR =\fI \, never\/ \fR ').
.HP
2018-08-27 20:57:47 +00:00
\fB \- l\fR , \fB \- \- language\fR <language>
.IP
2019-08-31 12:47:04 +00:00
Explicitly set the language for syntax highlighting. The language can be
specified as a name (like 'C++' or 'LaTeX') or possible file extension
(like 'cpp', 'hpp' or 'md'). Use '\- \- list\- languages' to show all supported
language names and file extensions.
2018-08-27 20:57:47 +00:00
.HP
2020-03-15 22:15:30 +00:00
\fB \- H\fR , \fB \- \- highlight\- line\fR <N:M>...
2018-08-27 20:57:47 +00:00
.IP
2021-01-10 20:14:00 +00:00
Highlight the specified line ranges with a different background color. For example:
2020-03-15 22:15:30 +00:00
.RS
.IP "\-\-highlight\-line 40"
highlights line 40
.IP "\-\-highlight\-line 30:40"
highlights lines 30 to 40
.IP "\-\-highlight\-line :40"
highlights lines 1 to 40
.IP "\-\-highlight\-line 40:"
highlights lines 40 to the end of the file
.RE
2018-08-27 20:57:47 +00:00
.HP
2021-01-10 20:14:00 +00:00
\fB \- \- file\- name\fR <name>...
.IP
Specify the name to display for a file. Useful when piping data to {{PROJECT_EXECUTABLE}} from STDIN when {{PROJECT_EXECUTABLE}} does not otherwise know the filename. Note that the provided file name is also used for syntax detection.
.HP
\fB \- d\fR , \fB \- \- diff\fR
.IP
Only show lines that have been added/removed/modified with respect to the Git index. Use '\- \- diff\- context=N' to control how much context you want to see.
.HP
\fB \- \- diff\- context\fR <N>...
.IP
Include N lines of context around added/removed/modified lines when using '\- \- diff'.
.HP
2019-10-23 22:25:02 +00:00
\fB \- \- tabs\fR <T>
2018-08-27 20:57:47 +00:00
.IP
2020-03-15 22:15:30 +00:00
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
2018-08-27 20:57:47 +00:00
.HP
2019-10-23 22:25:02 +00:00
\fB \- \- wrap\fR <mode>
2018-08-27 20:57:47 +00:00
.IP
2020-03-15 22:15:30 +00:00
Specify the text\- wrapping mode (*auto*, never, character). The '\- \- terminal\- width' option
can be used in addition to control the output width.
2018-08-27 20:57:47 +00:00
.HP
2019-10-23 22:25:02 +00:00
\fB \- \- terminal\- width\fR <width>
2018-08-27 20:57:47 +00:00
.IP
2020-03-15 22:15:30 +00:00
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'.
2018-08-27 20:57:47 +00:00
.HP
\fB \- n\fR , \fB \- \- number\fR
.IP
2020-03-15 22:15:30 +00:00
Only show line numbers, no other decorations. This is an alias for '\- \- style=numbers'
2018-08-27 20:57:47 +00:00
.HP
\fB \- \- color\fR <when>
.IP
2020-03-15 22:15:30 +00:00
Specify when to use colored output. The automatic mode only enables colors if an
interactive terminal is detected. Possible values: *auto*, never, always.
2018-08-27 20:57:47 +00:00
.HP
2018-11-11 11:31:28 +00:00
\fB \- \- italic\- text\fR <when>
.IP
2020-03-15 22:15:30 +00:00
Specify when to use ANSI sequences for italic text in the output. Possible values:
always, *never*.
2018-11-11 11:31:28 +00:00
.HP
2018-08-27 20:57:47 +00:00
\fB \- \- decorations\fR <when>
.IP
2020-03-15 22:15:30 +00:00
Specify when to use the decorations that have been specified via '\- \- style'. The
automatic mode only enables decorations if an interactive terminal is detected. Possible
values: *auto*, never, always.
2018-08-27 20:57:47 +00:00
.HP
2020-09-12 04:26:53 +00:00
\fB \- f\fR , \fB \- \- force\- colorization\fR
.IP
Alias for '--decorations=always --color=always'. This is useful \
2020-10-05 18:45:30 +00:00
if the output of {{PROJECT_EXECUTABLE}} is piped to another program, but you want \
2020-09-12 04:26:53 +00:00
to keep the colorization/decorations.
.HP
2018-08-27 20:57:47 +00:00
\fB \- \- paging\fR <when>
.IP
2020-07-02 07:07:37 +00:00
Specify when to use the pager. To disable the pager, use \& '\- \- paging=never' or its alias,
\fB -P\fR . To disable the pager permanently, set BAT_PAGER to an empty string. To control
which pager is used, see the '\- \- pager' option. Possible values: *auto*, never, always.
2018-11-11 11:31:28 +00:00
.HP
\fB \- \- pager\fR <command>
.IP
2020-07-02 07:07:37 +00:00
Determine which pager is used. This option will override the PAGER and BAT_PAGER
environment variables. The default pager is 'less'. To control when the pager is used, see
2020-03-15 22:15:30 +00:00
the '\- \- paging' option. Example: '\- \- pager "less \fB \- RF\fR "'.
2018-08-27 20:57:47 +00:00
.HP
2020-03-22 09:37:18 +00:00
\fB \- m\fR , \fB \- \- map\- syntax\fR <glob-pattern:syntax-name>...
2018-08-27 20:57:47 +00:00
.IP
2020-03-22 09:37:18 +00:00
Map a glob pattern to an existing syntax name. The glob pattern is matched on the full
path and the filename. For example, to highlight *.build files with the Python syntax,
use -m '*.build:Python'. To highlight files named '.myignore' with the Git Ignore
syntax, use -m '.myignore:Git Ignore'.
2021-01-10 20:47:52 +00:00
Note that the right-hand side is the *name* of the syntax, not a file extension.
2018-08-27 20:57:47 +00:00
.HP
2019-10-23 22:25:02 +00:00
\fB \- \- theme\fR <theme>
2018-08-27 20:57:47 +00:00
.IP
2020-03-15 22:15:30 +00:00
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 BAT_THEME environment variable (e.g.: export BAT_THEME="...").
2019-10-23 22:25:02 +00:00
.HP
\fB \- \- list\- themes\fR
.IP
Display a list of supported themes for syntax highlighting.
.HP
\fB \- \- style\fR <style\- components>
.IP
2020-03-15 22:15:30 +00:00
Configure which elements (line numbers, file headers, grid borders, 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 to the configuration file or
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
2020-10-12 07:44:18 +00:00
values: *auto*, full, plain, changes, header, grid, rule, numbers, snip.
2019-10-23 22:25:02 +00:00
.HP
\fB \- r\fR , \fB \- \- line\- range\fR <N:M>...
.IP
Only print the specified range of lines for each file. For example:
.RS
.IP "\-\-line\-range 30:40"
prints lines 30 to 40
.IP "\-\-line\-range :40"
prints lines 1 to 40
.IP "\-\-line\-range 40:"
prints lines 40 to the end of the file
.RE
.HP
\fB \- L\fR , \fB \- \- list\- languages\fR
.IP
Display a list of supported languages for syntax highlighting.
2018-08-27 20:57:47 +00:00
.HP
2018-10-17 21:13:50 +00:00
\fB \- u\fR , \fB \- \- unbuffered\fR
2018-09-12 20:00:28 +00:00
.IP
2020-03-15 22:15:30 +00:00
This option exists for POSIX\- compliance reasons ('u' is for 'unbuffered'). The output is
always unbuffered \- this option is simply ignored.
2018-09-12 20:00:28 +00:00
.HP
2018-08-27 20:57:47 +00:00
\fB \- h\fR , \fB \- \- help\fR
.IP
Print this help message.
.HP
\fB \- V\fR , \fB \- \- version\fR
.IP
Show version information.
2020-03-15 22:15:30 +00:00
.SH "POSITIONAL ARGUMENTS"
.HP
\fB <FILE>...\fR
2018-08-27 20:57:47 +00:00
.IP
2020-03-15 22:15:30 +00:00
Files to print and concatenate. Use a dash ('\- ') or no argument at all to read from
standard input.
2018-08-27 20:57:47 +00:00
.SH "SUBCOMMANDS"
2020-03-15 22:15:30 +00:00
.HP
\fB cache\fR - Modify the syntax\- definition and theme cache.
.SH "FILES"
{{PROJECT_EXECUTABLE}} can also be customized with a configuration file. The location of the file
is dependent on your operating system. To get the default path for your system, call:
\fB {{PROJECT_EXECUTABLE}} --config-file\fR
2020-10-05 18:45:30 +00:00
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
2020-03-15 22:15:30 +00:00
location of the configuration file.
2021-06-23 11:38:02 +00:00
To generate a default configuration file, call:
\fB {{PROJECT_EXECUTABLE}} --generate-config-file\fR
2020-10-01 11:27:53 +00:00
.SH "ADDING CUSTOM LANGUAGES"
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB .sublime-syntax\fR language files, and can be
2020-10-05 18:45:30 +00:00
customized to add additional languages to your local installation. To do this, add the \fB .sublime-syntax\fR language
files to `\fB $({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes\fR ` and run `\fB {{PROJECT_EXECUTABLE}} cache --build\fR `.
2020-10-01 11:27:53 +00:00
\fB Example:\fR
.RS 0 .5i
mkdir -p "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
.br
cd "$({{PROJECT_EXECUTABLE}} --config-dir)/syntaxes"
# Put new '.sublime-syntax' language definition files
.br
# in this folder (or its subdirectories), for example:
.br
git clone https://github.com/tellnobody1/sublime-purescript-syntax
# And then build the cache.
.br
{{PROJECT_EXECUTABLE}} cache --build
.RE
2020-10-05 18:45:30 +00:00
Once the cache is built, the new language will be visible in `\fB {{PROJECT_EXECUTABLE}} --list-languages\fR `.
2020-10-01 11:27:53 +00:00
.br
2020-10-05 18:45:30 +00:00
If you ever want to remove the custom languages, you can clear the cache with `\fB {{PROJECT_EXECUTABLE}} cache --clear\fR `.
2020-10-01 11:27:53 +00:00
.SH "ADDING CUSTOM THEMES"
Similarly to custom languages, {{PROJECT_EXECUTABLE}} supports Sublime Text \fB .tmTheme\fR themes.
These can be installed to `\fB $({{PROJECT_EXECUTABLE}} --config-dir)/themes\fR `, and are added to the cache with
`\fB {{PROJECT_EXECUTABLE}} cache --build`.
.SH "MORE INFORMATION"
For more information and up-to-date documentation, visit the {{PROJECT_EXECUTABLE}} repo:
.br
\fB https://github.com/sharkdp/bat\fR