When the search for the initial query doesn't finish immediately
fzf would trigger an invalid 'result' event for an empty query.
seq 100 | fzf --query 99 --bind result:accept --sync
# Prints 99
seq 1000000 | fzf --query 99 --bind result:accept --sync
# Should print 99, but fzf would print 1
The environment variable get the value of the preview label, even if it
has been updated with an action. It can be useful to track the label of
the preview and be able to switch between previews using only one
binding.
Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
This simplifies the distribution, and the users are less likely to have
problems caused by using incompatible scripts and binaries.
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)"
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --zsh)"
# Set up fzf key bindings
fzf --fish | source
For those who prefer to manage default options in a file.
If the file is not found, fzf will exit with an error.
We're not setting a default value for it because:
1. it's hard to find a default value that can be universally agreed upon
2. to avoid fzf having to check for the existence of the file even when it's not used
Because fzf processes HTTP GET requests in the main event loop,
accessing the endpoint from within execute/transform actions would
result in a deadlock and hang fzf indefinitely. This commit sets
a 2 second timeout to avoid the deadlock.
So that it can determine if it should subtract 1 from $FZF_PREVIEW_LINES
to avoid scrolling issue of Sixel image that touches the bottom of the
screen.
Progress:
* Sixel image can now be displayed with other text, and is scrollable
* If an image can't be displayed entirely due to the scroll offset, fzf
will render a wireframe to indicate that an image should be displayed
* Renamed $FZF_PREVIEW_{WIDTH,HEIGHT} to $FZF_PREVIEW_PIXEL_{WIDTH,HEIGHT}
for clarity
* Added bin/fzf-preview.sh script to demonstrate how to display an image
using Kitty or Sixel protocol
An example:
ls *.jpg | fzf --preview='seq $((FZF_PREVIEW_LINES*9/10)); fzf-preview.sh {}; seq 100'
A known issue:
* If you reduce the size of the preview window, the image may extend
beyond the preview window
# Scrolling will behave similarly to CTRL-E and CTRL-Y of vim
fzf --bind scroll-up:offset-up,scroll-down:offset-down \
--bind ctrl-y:offset-up,ctrl-e:offset-down \
--scroll-off=5
Close#3456