Bat: Difference between revisions

From wikinotes
 
(4 intermediate revisions by the same user not shown)
Line 9: Line 9:
|}
|}
</blockquote><!-- Documentation -->
</blockquote><!-- Documentation -->
= Locations =
<blockquote>
{| class="wikitable"
|-
| <code>~/.config/bat/config</code> || user config
|-
| <code>/etc/bat/config</code> || system config
|-
|}
</blockquote><!-- Locations -->


= Usage =
= Usage =
Line 14: Line 25:
<source lang="bash">
<source lang="bash">
bat file.graphql
bat file.graphql
bat \
  -l go  `# syntaxhighlight for lang` \
  --file-name 'my-file.go'  `# set file title in result` \
  --theme 'Monokai Extended Light'
</source>
syntaxhighlighting
<syntaxhighlight lang="bash">
bat --list-languages
bat --list-languages
bat -l Python
bat -l Python
echo '{ __schema { fields { name } } }' | bat -l graphql
echo '{ __schema { fields { name } } }' | bat -l graphql
</source>
</syntaxhighlight>
</blockquote><!-- Usage -->
</blockquote><!-- Usage -->
= Configuration =
<blockquote>
== Config File ==
<blockquote>
<syntaxhighlight lang="bash">
# ~/.config/bat/config
# the config-file simply defines CLI params.
# comments are allowed
# escaping lines is unecessary
--theme="TwoDark"
</syntaxhighlight>
</blockquote><!-- Config File -->
== Environment Variables ==
<blockquote>
<syntaxhighlight lang="bash">
BAT_THEME="TwoDark"
BAT_CONFIG_PATH="/path/to/bat.conf"
</syntaxhighlight>
</blockquote><!-- Environment Variables -->
</blockquote><!-- Configuration -->

Latest revision as of 21:54, 6 May 2023

Bat is a syntax highlighted cat.

Documentation

github https://github.com/sharkdp/bat

Locations

~/.config/bat/config user config
/etc/bat/config system config

Usage

bat file.graphql

bat \
  -l go  `# syntaxhighlight for lang` \
  --file-name 'my-file.go'  `# set file title in result` \
  --theme 'Monokai Extended Light'

syntaxhighlighting

bat --list-languages
bat -l Python
echo '{ __schema { fields { name } } }' | bat -l graphql

Configuration

Config File

# ~/.config/bat/config

# the config-file simply defines CLI params.
# comments are allowed
# escaping lines is unecessary
--theme="TwoDark"

Environment Variables

BAT_THEME="TwoDark"
BAT_CONFIG_PATH="/path/to/bat.conf"