diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2020-10-18 17:03:33 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-18 17:03:33 +0900 |
commit | faf68dbc5cc52201d0962f73baa5a049528b913c (patch) | |
tree | 12aaf9aa85163a8f140345d178b836d40e09342b /README.md | |
parent | 305896fcb3b76c5ea94401f6cce74f0f287e8f21 (diff) |
Implement streaming preview window (#2215)
Fix #2212
# Will start rendering after 200ms, update every 100ms
fzf --preview 'for i in $(seq 100); do echo $i; sleep 0.01; done'
# Should print "Loading .." message after 500ms
fzf --preview 'sleep 1; for i in $(seq 100); do echo $i; sleep 0.01; done'
# The first line should appear after 200ms
fzf --preview 'date; sleep 2; date'
# Should not render before enough lines for the scroll offset are ready
rg --line-number --no-heading --color=always ^ |
fzf --delimiter : --ansi --preview-window '+{2}-/2' \
--preview 'sleep 1; bat --style=numbers --color=always --pager=never --highlight-line={2} {1}'
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -582,9 +582,9 @@ and fzf will warn you about it. To suppress the warning message, we added ### Preview window -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`. +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 @@ -592,16 +592,8 @@ The window can be scrolled using the mouse or custom key bindings. fzf --preview 'cat {}' ``` -Since the preview window is updated only after the process is complete, it's -important that the command finishes quickly. - -```bash -# Use head instead of cat so that the command doesn't take too long to finish -fzf --preview 'head -100 {}' -``` - Preview window supports ANSI colors, so you can use any program that -syntax-highlights the content of a file, such as +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): |