add new section for sytax of file in README.md

This commit is contained in:
henil 2020-10-05 22:20:26 +05:30 committed by David Peter
parent 4ec6075f81
commit 4be32cf746
1 changed files with 14 additions and 5 deletions

View File

@ -492,17 +492,26 @@ alias cat="bat --theme=\$(defaults read -globalDomain AppleInterfaceStyle &> /de
### Syntax of a file
You can configure `bat` to change the default syntax of the file using `--map-syntax`. Use glob pattern to match exact filename.
You can change the default syntax highlighting of the file using `--map-syntax` option.
It uses glob pattern matching and is matched on full path and filename.
Use it like this:
```bash
bat --map-syntax='PATTERN:SYNTAX' file-name
```
For example:
```bash
# Use INI syntax for .conf files
--map-syntax "*.conf:INI"
# Using `INI` file syntax highligting when opening a file with extension `.conf`.
bat --map-syntax='*.conf:INI' file.conf
# Use ".gitignore"-style highlighting for ".ignore" files
--map-syntax ".ignore:Git Ignore"
# Using `Git Ignore` file syntax highlighting for ".ignore" files
bat --map-syntax='.ignore:Git Ignore' .ignore
```
You can use `bat --list-languages` to see all the file syntax types available.
## Configuration file
`bat` can also be customized with a configuration file. The location of the file is dependent