diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 00:22:28 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-26 00:49:16 +0900 |
commit | d02b9442a56ec03dbb905d432762cf545603ef07 (patch) | |
tree | fdf5878111abb8693a559fff355e499c49378782 /man | |
parent | bac385b59ccef279400689d406bf270cfdee06f3 (diff) |
(Experimental) Improve Sixel graphics support (#2544)
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
Diffstat (limited to 'man')
-rw-r--r-- | man/man1/fzf.1 | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1 index 735fa7f6..8666ec02 100644 --- a/man/man1/fzf.1 +++ b/man/man1/fzf.1 @@ -592,34 +592,12 @@ e.g. sleep 0.01 done'\fR -Since 0.43.0, fzf has experimental support for Kitty graphics protocol, -so if you use Kitty, you can make fzf display an image in the preview window. +fzf has experimental support for Kitty graphics protocol and Sixel graphics. +The following example uses https://github.com/junegunn/fzf/blob/master/bin/fzf-preview.sh +script to render an image using either of the protocols inside the preview window. e.g. - \fBfzf --preview=' - if file --mime-type {} | grep -qF "image/"; then - kitty icat --clear --transfer-mode=memory --stdin=no --place=${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}@0x0 {} | sed \\$d - else - bat --color=always {} - fi - '\fR - -fzf also has experimental support for Sixel graphics. - -e.g. - \fB# 1. $FZF_PREVIEW_WIDTH and $FZF_PREVIEW_HEIGHT will be set to - # the pixel width and height of the preview window - # 2. Special preview window flag 'clear' is needed to always completely - # erase the preview window - fzf --preview=' - if file --mime-type {} | grep -qvF image/; then - bat --color=always {} - elif [[ -n $FZF_PREVIEW_WIDTH ]]; then - convert {} -resize ${FZF_PREVIEW_WIDTH}x${FZF_PREVIEW_HEIGHT} sixel:- - else - echo "Cannot display image data (unsupported platform)" - fi - ' --preview-window clear\fR + \fBfzf --preview='fzf-preview.sh {}' .RE |