Aloxaf / fzf-tab

Replace zsh's default completion selection menu with fzf!
MIT License
3.28k stars 94 forks source link

[Q]can not preview the image in fzf's preview window #333

Closed tiancheng92 closed 1 year ago

tiancheng92 commented 1 year ago

I can not preview the image in fzf's preview window

截图2022-12-06 17-40-02@1x

I use wezterm zsh5.9

# fzf-tab预览
_preview()
{
    local file="$1"
    if [[ -d "${file}" ]] || [[ -h "${file}" ]]; then
        lsd -A --tree --depth 1 "${file}"
    elif [[ -f "${file}" ]]; then
        local info="$(file "${file}")"
        if [[ "${file}" == *.md ]]; then
            mdcat -l ${file}
        elif [[ "${file}" == *.pdf ]];then
            pdftotext ${file} -
        elif [[ "${info}" == *text* ]]; then
            bat "${file}" 2> /dev/null
        elif [[ "${info}" == *image\ data* ]]; then
            chafa "$1"
            exiftool "$1"
        else
            builtin echo "${info}"
        fi
    else
        builtin echo "${file}" | lolcat -f
    fi
}
Aloxaf commented 1 year ago

duplicate of https://github.com/Aloxaf/fzf-tab/issues/303

And the preview function is provided by fzf, I can do nothing with it.