2020-09-20 19:50:39 +02:00
.TH {{PROJECT_EXECUTABLE_UPPERCASE}} "1"
2018-08-27 22:57:47 +02:00
.SH NAME
2020-03-15 23:15:30 +01:00
{{PROJECT_EXECUTABLE}} \- a cat(1) clone with syntax highlighting and Git integration.
2018-08-27 22:57:47 +02:00
.SH "USAGE"
2020-03-15 23:15:30 +01: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 22:57:47 +02:00
.SH "OPTIONS"
2020-03-15 23:15:30 +01:00
General remarks: Command-line options like '-l'/'--language' that take values can be specified as
2019-08-15 21:57:32 +02:00
either '--language value', '--language=value', '-l value' or '-lvalue'.
.HP
2019-10-24 00:25:02 +02: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
2023-03-25 10:36:14 +01:00
\fB \- \- nonprintable\- notation\fR <notation>
2023-03-25 10:31:31 +01:00
.IP
Specify how to display non-printable characters when using \- \- show\- all.
Possible values:
.RS
.IP "caret"
Use character sequences like ^G, ^J, ^@, .. to identify non-printable characters
.IP "unicode"
Use special Unicode code points to identify non-printable characters
.RE
.HP
2019-10-24 00:25:02 +02:00
\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
2022-07-06 07:48:53 +02:00
automatic paging (alias for '\- \- style=plain \fB \- \- paging\fR =\fI \, never\/ \fR ').
2019-10-24 00:25:02 +02:00
.HP
2018-08-27 22:57:47 +02:00
\fB \- l\fR , \fB \- \- language\fR <language>
.IP
2019-08-31 14:47:04 +02: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 22:57:47 +02:00
.HP
2020-03-15 23:15:30 +01:00
\fB \- H\fR , \fB \- \- highlight\- line\fR <N:M>...
2018-08-27 22:57:47 +02:00
.IP
2021-01-10 21:14:00 +01:00
Highlight the specified line ranges with a different background color. For example:
2020-03-15 23:15:30 +01: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
2021-08-21 19:55:52 +02:00
.IP "\-\-highlight\-line 30:+10"
highlights lines 30 to 40
2020-03-15 23:15:30 +01:00
.RE
2018-08-27 22:57:47 +02:00
.HP
2021-01-10 21:14:00 +01: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-24 00:25:02 +02:00
\fB \- \- tabs\fR <T>
2018-08-27 22:57:47 +02:00
.IP
2020-03-15 23:15:30 +01:00
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
2018-08-27 22:57:47 +02:00
.HP
2019-10-24 00:25:02 +02:00
\fB \- \- wrap\fR <mode>
2018-08-27 22:57:47 +02:00
.IP
2020-03-15 23:15:30 +01: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 22:57:47 +02:00
.HP
2024-06-09 13:24:00 +02:00
\fB \- S\fR , \fB \- \- chop\- long\- lines\fR
.IP
Truncate all lines longer than screen width. Alias for '\- \- wrap=never'.
.HP
2019-10-24 00:25:02 +02:00
\fB \- \- terminal\- width\fR <width>
2018-08-27 22:57:47 +02:00
.IP
2020-03-15 23:15:30 +01: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 22:57:47 +02:00
.HP
\fB \- n\fR , \fB \- \- number\fR
.IP
2020-03-15 23:15:30 +01:00
Only show line numbers, no other decorations. This is an alias for '\- \- style=numbers'
2018-08-27 22:57:47 +02:00
.HP
\fB \- \- color\fR <when>
.IP
2020-03-15 23:15:30 +01: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 22:57:47 +02:00
.HP
2018-11-11 12:31:28 +01:00
\fB \- \- italic\- text\fR <when>
.IP
2020-03-15 23:15:30 +01:00
Specify when to use ANSI sequences for italic text in the output. Possible values:
always, *never*.
2018-11-11 12:31:28 +01:00
.HP
2018-08-27 22:57:47 +02:00
\fB \- \- decorations\fR <when>
.IP
2020-03-15 23:15:30 +01: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 22:57:47 +02:00
.HP
2020-09-12 06:26:53 +02:00
\fB \- f\fR , \fB \- \- force\- colorization\fR
.IP
Alias for '--decorations=always --color=always'. This is useful \
2020-10-05 20:45:30 +02:00
if the output of {{PROJECT_EXECUTABLE}} is piped to another program, but you want \
2020-09-12 06:26:53 +02:00
to keep the colorization/decorations.
.HP
2018-08-27 22:57:47 +02:00
\fB \- \- paging\fR <when>
.IP
2020-07-02 09:07:37 +02: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 12:31:28 +01:00
.HP
\fB \- \- pager\fR <command>
.IP
2020-07-02 09:07:37 +02: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 23:15:30 +01:00
the '\- \- paging' option. Example: '\- \- pager "less \fB \- RF\fR "'.
2021-12-24 19:57:10 +01:00
Note: By default, if the pager is set to 'less' (and no command-line options are specified), 'bat' will pass the following command line options to the pager: '-R'/'--RAW-CONTROL-CHARS', '-F'/'--quit-if-one-screen' and '-X'/'--no-init'. The last option ('-X') is only used for 'less' versions older than 530. The '-R' option is needed to interpret ANSI colors correctly. The second option ('-F') instructs less to exit immediately if the output size is smaller than the vertical size of the terminal. This is convenient for small files because you do not have to press 'q' to quit the pager. The third option ('-X') is needed to fix a bug with the '--quit-if-one-screen' feature in old versions of 'less'. Unfortunately, it also breaks mouse-wheel support in 'less'. If you want to enable mouse-wheel scrolling on older versions of 'less', you can pass just '-R' (as in the example above, this will disable the quit-if-one-screen feature). For less 530 or newer, it should work out of the box.
2018-08-27 22:57:47 +02:00
.HP
2020-03-22 10:37:18 +01:00
\fB \- m\fR , \fB \- \- map\- syntax\fR <glob-pattern:syntax-name>...
2018-08-27 22:57:47 +02:00
.IP
2020-03-22 10:37:18 +01: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 21:47:52 +01:00
Note that the right-hand side is the *name* of the syntax, not a file extension.
2018-08-27 22:57:47 +02:00
.HP
2024-06-09 13:24:00 +02:00
\fB \- \- ignored\- suffix\fR <ignored-suffix>
.IP
Ignore extension. For example: 'bat \- \- ignored-suffix ".dev" my_file.json.dev'
will use JSON syntax, and ignore '.dev'
.HP
2019-10-24 00:25:02 +02:00
\fB \- \- theme\fR <theme>
2018-08-27 22:57:47 +02:00
.IP
2024-04-16 14:43:24 +02:00
Set the theme for syntax highlighting. Use \fB \- \- list\- themes\fP to see all available themes.
To set a default theme, add the \fB \- \- theme="..."\fP option to the configuration file or
export the \fB BAT_THEME\fP environment variable (e.g.: \fB export BAT_THEME="..."\fP ).
.HP
\fB \- \- theme\- dark\fR <theme>
.IP
Sets the theme name for syntax highlighting used when the terminal uses a dark background.
2024-08-18 14:59:14 +02:00
To set a default theme, add the \fB \- \- theme-dark="..."\fP option to the configuration file or
2024-04-16 14:43:24 +02:00
export the \fB BAT_THEME_DARK\fP environment variable (e.g. \fB export BAT_THEME_DARK="..."\fP ).
This option is ignored if \fB \- \- theme\fP option is set.
.HP
\fB \- \- theme\- light\fR <theme>
.IP
Sets the theme name for syntax highlighting used when the terminal uses a dark background.
2024-08-18 14:59:14 +02:00
To set a default theme, add the \fB \- \- theme-dark="..."\fP option to the configuration file or
2024-04-16 14:43:24 +02:00
export the \fB BAT_THEME_LIGHT\fP environment variable (e.g. \fB export BAT_THEME_LIGHT="..."\fP ).
This option is ignored if \fB \- \- theme\fP option is set.
2019-10-24 00:25:02 +02:00
.HP
\fB \- \- list\- themes\fR
.IP
Display a list of supported themes for syntax highlighting.
.HP
2024-06-09 13:24:00 +02:00
\fB \- s\fR , \fB \- \- squeeze\- blank\fR
.IP
Squeeze consecutive empty lines into a single empty line.
.HP
\fB \- \- squeeze\- limit\fR <squeeze-limit>
.IP
Set the maximum number of consecutive empty lines to be printed.
.HP
2019-10-24 00:25:02 +02:00
\fB \- \- style\fR <style\- components>
.IP
2020-03-15 23:15:30 +01: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
2022-05-04 21:31:32 +02:00
values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
2022-02-26 17:54:09 +01:00
rule, numbers, snip.
2019-10-24 00:25:02 +02: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
2021-08-21 19:55:52 +02:00
.IP "\-\-line\-range 30:+10"
prints lines 30 to 40
2019-10-24 00:25:02 +02:00
.RE
.HP
\fB \- L\fR , \fB \- \- list\- languages\fR
.IP
Display a list of supported languages for syntax highlighting.
2018-08-27 22:57:47 +02:00
.HP
2018-10-17 23:13:50 +02:00
\fB \- u\fR , \fB \- \- unbuffered\fR
2018-09-12 22:00:28 +02:00
.IP
2020-03-15 23:15:30 +01: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 22:00:28 +02:00
.HP
2024-06-10 01:13:23 +02:00
\fB \- \- no\- custom\- assets\fR
.IP
Do not load custom assets.
.HP
\fB \- \- config\- dir\fR
.IP
Show bat's configuration directory.
.HP
\fB \- \- cache\- dir\fR
.IP
Show bat's cache directory.
.HP
2024-06-09 13:24:00 +02:00
\fB \- \- diagnostic\fR
.IP
Show diagnostic information for bug reports.
.HP
\fB \- \- acknowledgements\fR
.IP
Show acknowledgements.
.HP
\fB \- \- set\- terminal\- title\fR
.IP
Sets terminal title to filenames when using a pager.
.HP
2018-08-27 22:57:47 +02: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 23:15:30 +01:00
.SH "POSITIONAL ARGUMENTS"
.HP
\fB <FILE>...\fR
2018-08-27 22:57:47 +02:00
.IP
2020-03-15 23:15:30 +01:00
Files to print and concatenate. Use a dash ('\- ') or no argument at all to read from
standard input.
2018-08-27 22:57:47 +02:00
.SH "SUBCOMMANDS"
2020-03-15 23:15:30 +01: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 20:45:30 +02:00
Alternatively, you can use the BAT_CONFIG_PATH environment variable to point {{PROJECT_EXECUTABLE}} to a non-default
2020-03-15 23:15:30 +01:00
location of the configuration file.
2021-06-23 13:38:02 +02:00
To generate a default configuration file, call:
\fB {{PROJECT_EXECUTABLE}} --generate-config-file\fR
2024-06-10 01:13:23 +02:00
These are related options:
.HP
\fB \- \- config\- file\fR
.IP
Show path to the configuration file.
.HP
\fB \- \- generate-config\- file\fR
.IP
Generates a default configuration file.
.HP
\fB \- \- no\- config\fR
.IP
Do not use the configuration file.
2020-10-01 13:27:53 +02:00
.SH "ADDING CUSTOM LANGUAGES"
{{PROJECT_EXECUTABLE}} supports Sublime Text \fB .sublime-syntax\fR language files, and can be
2020-10-05 20:45:30 +02: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 13:27:53 +02: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 20:45:30 +02:00
Once the cache is built, the new language will be visible in `\fB {{PROJECT_EXECUTABLE}} --list-languages\fR `.
2020-10-01 13:27:53 +02:00
.br
2021-08-21 12:25:26 +02: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 13:27:53 +02: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`.
2023-09-02 08:48:26 +02:00
.SH "INPUT PREPROCESSOR"
Much like less(1) does, {{PROJECT_EXECUTABLE}} supports input preprocessors via the LESSOPEN and LESSCLOSE environment variables.
In addition, {{PROJECT_EXECUTABLE}} attempts to be as compatible with less's preprocessor implementation as possible.
2023-09-06 04:40:29 +02:00
To use the preprocessor, call:
\fB {{PROJECT_EXECUTABLE}} --lessopen\fR
2024-08-18 14:59:14 +02:00
Alternatively, the preprocessor may be enabled by default by adding the '\- \- lessopen' option to the configuration file.
2023-09-06 04:40:29 +02:00
To temporarily disable the preprocessor if it is enabled by default, call:
2023-09-02 08:48:26 +02:00
\fB {{PROJECT_EXECUTABLE}} --no-lessopen\fR
2024-06-10 01:13:23 +02:00
These are related options:
.HP
\fB \- \- lessopen\fR
.IP
Enable the $LESSOPEN preprocessor.
.HP
\fB \- \- no\- lessopen\fR
.IP
Disable the $LESSOPEN preprocessor if enabled (overrides --lessopen)
.PP
2024-08-18 14:59:14 +02:00
For more information, see the "INPUT PREPROCESSOR" section of less(1).
2023-09-02 08:48:26 +02:00
2020-10-01 13:27:53 +02:00
.SH "MORE INFORMATION"
For more information and up-to-date documentation, visit the {{PROJECT_EXECUTABLE}} repo:
.br
\fB https://github.com/sharkdp/bat\fR