Repository: sharkdp/bat (language: rust)

Issue:
Map syntax seems to hang
<!-- Hey there, thank you for creating an issue! -->

## Describe the bug you encountered:

I am trying to map `*.csproj` to use XML. I am running

```sh
bat --map-syntax='*.csproj:XML'
```

It has been sitting there for several minutes with no output.

## What did you expect to happen instead?

Seems like this would finish quickly, no?


## How did you install `bat`?

Homebrew

---

**bat version and environment**

#### Software version

bat 0.18.3

#### Operating system

macOS 11.6.2 (Darwin 20.6.0)

#### Command-line

```bash
bat --diagnostic
```

#### Environment variables

```bash
SHELL=/usr/local/bin/bash
PAGER=<not set>
LESS=<not set>
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>
```

#### Config file

```
# This is `bat`s configuration file. Each line either contains a comment or
# a command-line option that you want to pass to `bat` by default. You can
# run `bat --help` to get a list of all possible configuration options.

# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
# for a list of all available themes
--theme="Mariana"

# Enable this to use italic text on the terminal. This is not supported on all
# terminal emulators (like tmux, by default):
#--italic-text=always

# Uncomment the following line to disable automatic paging:
#--paging=never

# Uncomment the following line if you are using less version >= 551 and want to
# enable mouse scrolling support in `bat` when running inside tmux. This might
# disable text selection, unless you press shift.
#--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"

# Syntax mappings: map a certain filename pattern to a language.
#   Example 1: use the C++ syntax for .ino files
#   Example 2: Use ".gitignore"-style highlighting for ".ignore" files
#--map-syntax "*.ino:C++"
#--map-syntax ".ignore:Git Ignore"
```

#### Compile time information

- Profile: release
- Target triple: x86_64-apple-darwin
- Family: unix
- OS: macos
- Architecture: x86_64
- Pointer width: 64
- Endian: little
- CPU features: fxsr,sse,sse2,sse3,ssse3
- Host: x86_64-apple-darwin

#### Less version

```
> less --version
less 487 (POSIX regular expressions)
Copyright (C) 1984-2016  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
```


Discussion / hints:
It took me a while to find `bat --config-file`, but I have now successfully added the mapping. And I've <kbd>Ctrl</kbd>+<kbd>C</kbd>'d the attempt to map with the `bat` binary.
Hi, thanks for reporting. Because you didn't specify a file, bat is waiting for the standard input stream to end I believe. Maybe we can improve the documentation to make it clear that that command line arg doesn't update the config file and quit? 
> &hellip;make it clear that that command line arg doesn't update the config file and quit?

Yes please. Perhaps change

> Note: You probably want to use this option as an entry in `bat`s configuration file instead of passing it on the command line (see below).

to something like

> **Note:** You probably want to use this option as [an entry in `bat`'s configuration file](https://github.com/sharkdp/bat#configuration-file) instead of passing it on the command line like the examples below.

I'm not sure why anyone would use `--map-syntax` with stdin. Is there even a file type to map?

For real files, I can understand why having a CLI override is nice.
> I'm not sure why anyone would use `--map-syntax` with stdin. Is there even a file type to map?

Nope, but I guess `bat` doesn't differentiate all that much between files and stdin, and doing so to make some args behave differently would complicate the codebase and potentially cause more confusion ;)

Fix patch:
diff --git a/README.md b/README.md
index f108a94350..85b63547fa 100644
--- a/README.md
+++ b/README.md
@@ -515,8 +515,9 @@ command line option. The option takes an argument of the form `pattern:syntax` w
 the absolute file path. The `syntax` part is the full name of a supported language
 (use `bat --list-languages` for an overview).
 
-Note: You probably want to use this option as an entry in `bat`s configuration file instead
-of passing it on the command line (see below).
+**Note:** You probably want to use this option as [an entry in `bat`'s configuration file](#configuration-file)
+for persistence instead of passing it on the command line as a one-off. Generally
+you'd just use `-l` if you want to manually specify a language for a file.
 
 Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
 ```bash


Test patch: