summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorJanek <27jf@pm.me>2020-06-04 04:57:01 +0200
committerGitHub <noreply@github.com>2020-06-04 11:57:01 +0900
commit43d1c4c4b581929a1d440992c0f73531158e28a5 (patch)
treecef2a253e3a7871247591b5cf8335ffb462d1039 /README.md
parentf81feb1e69e5cb75797d50817752ddfe4933cd68 (diff)
README: Use --line-range instead of head in bat example (#2064)
* Use --line-range instead of head in bat example * README: extend preview section
Diffstat (limited to 'README.md')
-rw-r--r--README.md18
1 files changed, 9 insertions, 9 deletions
diff --git a/README.md b/README.md
index 4e368b02..bb4a2b54 100644
--- a/README.md
+++ b/README.md
@@ -529,9 +529,10 @@ See *KEY BINDINGS* section of the man page for details.
### Preview window
-When `--preview` option is set, fzf automatically starts an external process with
-the current line as the argument and shows the result in the split window. Your
-`$SHELL` is used to execute the command with `$SHELL -c COMMAND`.
+When the `--preview` option is set, fzf automatically starts an external process
+with the current line as the argument and shows the result in the split window.
+Your `$SHELL` is used to execute the command with `$SHELL -c COMMAND`.
+The window can be scrolled using the mouse or custom key bindings.
```bash
# {} is replaced to the single-quoted string of the focused line
@@ -547,13 +548,12 @@ fzf --preview 'head -100 {}'
```
Preview window supports ANSI colors, so you can use any program 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
+syntax-highlights the content of a file, such as
+[Bat](https://github.com/sharkdp/bat) or
+[Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php):
```bash
-fzf --preview 'bat --style=numbers --color=always {} | head -500'
+fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'
```
You can customize the size, position, and border of the preview window using
@@ -582,7 +582,7 @@ not a good idea to add `--preview` option to your `$FZF_DEFAULT_OPTS`**.
# *********************
# ** DO NOT DO THIS! **
# *********************
-export FZF_DEFAULT_OPTS='--preview "bat --style=numbers --color=always {} | head -500"'
+export FZF_DEFAULT_OPTS='--preview "bat --style=numbers --color=always --line-range :500 {}"'
# bat doesn't work with any input other than the list of files
ps -ef | fzf