mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-25 14:17:40 +00:00
README: Use --line-range instead of head in bat example (#2064)
* Use --line-range instead of head in bat example * README: extend preview section
This commit is contained in:
parent
f81feb1e69
commit
43d1c4c4b5
18
README.md
18
README.md
@ -529,9 +529,10 @@ See *KEY BINDINGS* section of the man page for details.
|
|||||||
|
|
||||||
### Preview window
|
### Preview window
|
||||||
|
|
||||||
When `--preview` option is set, fzf automatically starts an external process with
|
When the `--preview` option is set, fzf automatically starts an external process
|
||||||
the current line as the argument and shows the result in the split window. Your
|
with the current line as the argument and shows the result in the split window.
|
||||||
`$SHELL` is used to execute the command with `$SHELL -c COMMAND`.
|
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
|
```bash
|
||||||
# {} is replaced to the single-quoted string of the focused line
|
# {} 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
|
Preview window supports ANSI colors, so you can use any program that
|
||||||
syntax-highlights the content of a file.
|
syntax-highlights the content of a file, such as
|
||||||
|
[Bat](https://github.com/sharkdp/bat) or
|
||||||
- Bat: https://github.com/sharkdp/bat
|
[Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php):
|
||||||
- Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php
|
|
||||||
|
|
||||||
```bash
|
```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
|
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! **
|
# ** 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
|
# bat doesn't work with any input other than the list of files
|
||||||
ps -ef | fzf
|
ps -ef | fzf
|
||||||
|
Loading…
Reference in New Issue
Block a user