Replies: 1 comment
-
I'm having the same issue. I've been trying to fix this for several hours now, to no avail. Previews with file contents as per described in the wiki was working fine for me before, but now they're broken. I'm using Other previews code snippets from the wiki work fine ( I'm also using zstyle ':fzf-tab:complete:cd:*' fzf-preview 'lsd -al --color=always --icon=always --tree $realpath' which still works for But for anything else like My less "$FILE" does exactly what it's supposed to do. Only the preview with fzf-tab is broken. Have you ever found a solution? @Aloxaf any idea? For reference
#! /usr/bin/env bash
check_deps() { hash "$1" 2>/dev/null; }
MIME="$(file -bL --mime-type "$1")"
CATEGORY="${MIME%%/*}"
if [[ -d "$1" ]]; then
check_deps exa && exa -a --color=always -l -g --git --group-directories-first --icons "$1"
check_deps lsd && lsd -al --color=always --icon=always "$1"
elif [[ "$CATEGORY" == "image" ]]; then
check_deps chafa && chafa -f symbols "$1"
check_deps exiftool && exiftool "$1"
elif [[ "$CATEGORY" == "text" ]]; then
check_deps bat && bat --color=always --line-range :200 "$1"
elif [[ "$CATEGORY" == "video" ]]; then
check_deps mediainfo && mediainfo "$1"
else
lesspipe.sh "$1" | bat --color=always --line-range :200
fi ❯ echo $LESSOPEN
# It's available in my $PATH
|lessfilter.sh %s
❯ less --version
less 633 (PCRE2 regular expressions)
# cd
[[ -v commands[exa] ]] && zstyle ':fzf-tab:complete:cd:*' fzf-preview 'exa --color=always -l -a -g --git --group-directories-first --icons $realpath'
[[ -v commands[lsd] ]] && zstyle ':fzf-tab:complete:cd:*' fzf-preview 'lsd -al --color=always --icon=always --tree $realpath'
# Environment variables
zstyle ':fzf-tab:complete:(-command-|-parameter-|-brace-parameter-|export|unset|expand):*' fzf-preview 'echo ${(P)word}'
# kill
zstyle ':completion:*:*:*:*:processes' command 'ps -u $USER -o pid,user,comm -w -w'
zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-preview '[[ $group == "[process ID]" ]] && ps --pid=$word -o cmd --no-headers -w -w'
zstyle ':fzf-tab:complete:(kill|ps):argument-rest' fzf-flags --preview-window=down:3:wrap
# systemd units status
zstyle ':fzf-tab:complete:systemctl-*:*' fzf-preview 'SYSTEMD_COLORS=1 systemctl status $word'
# Tealdeer
zstyle ':fzf-tab:complete:tldr:argument-1' fzf-preview 'tldr --color always $word'
# Previews with lessfilter.sh
zstyle ':fzf-tab:complete:*:*' fzf-preview 'less ${(Q)realpath}'
zstyle ':fzf-tab:complete:*:*' fzf-flags --height=100% --preview-window=right:wrap
# Switch group with ',' and '.'
zstyle ':fzf-tab:*' switch-group ',' '.'
# Commands
zstyle ':fzf-tab:complete:-command-:*' fzf-preview \
'(out=$(tldr --color always "$word") 2>/dev/null && echo $out) || (out=$(MANWIDTH=$FZF_PREVIEW_COLUMNS man "$word" | bat --color=always -plman) 2>/dev/null && echo $out) || (out=$(which "$word") && echo $out) || echo "${(P)word}"'
# Disable previews for commands options and arguments
zstyle ':fzf-tab:complete:*:options' fzf-preview
zstyle ':fzf-tab:complete:*:argument-1' fzf-preview
zstyle ':fzf-tab:complete:chezmoi:*' fzf-preview
zstyle ':fzf-tab:complete:kitty:*' fzf-preview
zstyle ':fzf-tab:complete:rclone:*' fzf-preview
# Git
zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview \
'git diff $word | delta'
zstyle ':fzf-tab:complete:git-log:*' fzf-preview \
'git log --color=always $word'
zstyle ':fzf-tab:complete:git-help:*' fzf-preview \
'git help $word | bat -p -l man --color=always'
zstyle ':fzf-tab:complete:git-show:*' fzf-preview \
'case "$group" in
"commit tag") git show --color=always $word ;;
*) git show --color=always $word | delta ;;
esac'
zstyle ':fzf-tab:complete:git-checkout:*' fzf-preview \
'case "$group" in
"modified file") git diff $word | delta ;;
"recent commit object name") git show --color=always $word | delta ;;
*) git log --color=always $word ;;
esac'
|
Beta Was this translation helpful? Give feedback.
-
less /mnt/flicker_2W_images.7z
:less /mnt/<TAB>
to call fzf-tab:Why it only
1
not the result ofless
?Beta Was this translation helpful? Give feedback.
All reactions