[doc] Add bat for preview syntax highlighting example (#1538)

Similar to this PR from fzf.vim:
https://github.com/junegunn/fzf.vim/pull/712
This commit is contained in:
AnakinXL 2019-03-28 18:31:17 -07:00 committed by Junegunn Choi
parent 75972d59a8
commit 82efe6c60d
1 changed files with 4 additions and 2 deletions

View File

@ -498,15 +498,17 @@ fzf --preview 'head -100 {}'
Preview window supports ANSI colors, so you can use programs that
syntax-highlights the content of a file.
- Bat: https://github.com/sharkdp/bat
- Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
- CodeRay: http://coderay.rubychan.de/
- Rouge: https://github.com/jneen/rouge
```bash
# Try highlight, coderay, rougify in turn, then fall back to cat
# Try bat, highlight, coderay, rougify in turn, then fall back to cat
fzf --preview '[[ $(file --mime {}) =~ binary ]] &&
echo {} is a binary file ||
(highlight -O ansi -l {} ||
(bat --style=numbers --color=always {} ||
highlight -O ansi -l {} ||
coderay {} ||
rougify {} ||
cat {}) 2> /dev/null | head -500'