From aa04d6370bcd2745252bf82b9e7cbdef2c98a1d5 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Sun, 15 Sep 2024 16:04:37 +0200 Subject: [PATCH] change and document variable expansion --- plugins/preview-tui | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/preview-tui b/plugins/preview-tui index 80597f34..45177fdb 100755 --- a/plugins/preview-tui +++ b/plugins/preview-tui @@ -112,7 +112,7 @@ ENVVARS=( "NNN_PREVIEWWIDTH=${NNN_PREVIEWWIDTH:-1920}" # width of generated preview images "NNN_PREVIEWHEIGHT=${NNN_PREVIEWHEIGHT:-1080}" # height of generated preview images "NNN_PREVIEWDIR=${NNN_PREVIEWDIR:-$TMPDIR/nnn/previews}" # location of generated preview images - "NNN_PREVIEWIMGPROG=${NNN_PREVIEWIMGPROG:-}" # program used to preview images + "NNN_PREVIEWIMGPROG=${NNN_PREVIEWIMGPROG:-}" # command used to preview images "NNN_PREVIEWVIDEO=${NNN_PREVIEWVIDEO:-}" # mpv backend used to preview video ) # Non-configurable environment variables @@ -131,7 +131,7 @@ ENVVARS+=( ) trap '' PIPE -exists() { type "${1%% *}" >/dev/null 2>&1 ;} +exists() { type "$1" >/dev/null 2>&1 ;} pkill() { command pkill "$@" >/dev/null 2>&1 ;} prompt() { clear; printf "%b" "$@"; cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg" ;} pidkill() { @@ -452,7 +452,7 @@ image_preview() { wezterm imgcat "$3" & elif exists ueberzug && [[ "$NNN_PREVIEWIMGPROG" == +(|ueberzug) ]]; then ueberzug_layer "$1" "$2" "$3" && return - elif exists "$NNN_PREVIEWIMGPROG"; then + elif exists "${NNN_PREVIEWIMGPROG%% *}"; then # can include command flags; only check first word "$NNN_PREVIEWIMGPROG" "$3" & else fifo_pager print_bin_info "$3" && return