diff --git a/lib/file_preview.sh b/lib/file_preview.sh index 03e0424..fbfee86 100755 --- a/lib/file_preview.sh +++ b/lib/file_preview.sh @@ -6,7 +6,7 @@ if [ -d "$1" ]; then elif [ "$category" = text ]; then (bat -p --color=always "$1" || cat "$1") 2>/dev/null | head -1000 elif [ "$category" = image ]; then - command -v ueberzug 2&>/dev/null && bash $OMZ/lib/img_preview.sh "$1"|| img2txt "$1" + img2txt "$1" else echo $1 is a $category file fi diff --git a/lib/get_cursor.sh b/lib/get_cursor.sh deleted file mode 100644 index 553bd60..0000000 --- a/lib/get_cursor.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -exec < /dev/tty -oldstty=$(stty -g) -stty raw -echo min 0 -echo -en "\033[6n" > /dev/tty -IFS=';' read -r -d R -a pos -stty $oldstty -row=$((${pos[0]:2} - 1)) -col=$((${pos[1]} - 1)) -echo "export row=$row" > $OMZ/cache/cursor -echo "export col=$col" >> $OMZ/cache/cursor diff --git a/lib/img_preview.sh b/lib/img_preview.sh deleted file mode 100644 index e224c10..0000000 --- a/lib/img_preview.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -declare -r -x DEFAULT_PREVIEW_POSITION="right" -declare -r -x UEBERZUG_FIFO="$(mktemp --dry-run --suffix "fzf-$$-ueberzug")" -declare -r -x PREVIEW_ID="preview" - -function start_ueberzug { - mkfifo "${UEBERZUG_FIFO}" - <"${UEBERZUG_FIFO}" \ - ueberzug layer --parser bash --silent & - 3>"${UEBERZUG_FIFO}" \ - exec -} - -function finalise { - 3>&- \ - exec - &>/dev/null \ - rm "${UEBERZUG_FIFO}" - &>/dev/null \ - kill $(jobs -p) - killall ueberzug -} - -function draw_preview { - source $OMZ/cache/cursor - X=$(($COLUMNS / 2 + 2)) - Y=$((row + 2)) - if [ $Y -gt $((LINES - 11)) ]; then - Y=$((LINES - 11)) - fi - - >"${UEBERZUG_FIFO}" declare -A -p cmd=( \ - [action]=add [identifier]="${PREVIEW_ID}" \ - [x]="${X}" [y]="${Y}" \ - [width]="$(($COLUMNS / 2 - 2))" [height]="10" \ - [scaler]=forced_cover [scaling_position_x]=0.5 [scaling_position_y]=0.5 \ - [path]="${@}") -} - -trap finalise EXIT -start_ueberzug -draw_preview $* -sleep 999999 diff --git a/plugins/fzf-tab/fzf-tab.zsh b/plugins/fzf-tab/fzf-tab.zsh index 15413bc..3269670 100644 --- a/plugins/fzf-tab/fzf-tab.zsh +++ b/plugins/fzf-tab/fzf-tab.zsh @@ -211,7 +211,6 @@ fzf-tab-debug() { } fzf-tab-complete() { - bash $OMZ/lib/get_cursor.sh # this name must be ugly to avoid clashes local -i _ftb_continue=1 _ftb_continue_last=0 _ftb_accept=0 ret=0 # hide the cursor until finishing completion, so that users won't see cursor up and down