change and document variable expansion

This commit is contained in:
Luuk van Baal 2024-09-15 16:04:37 +02:00
parent 7571d172aa
commit aa04d6370b
No known key found for this signature in database
GPG key ID: E7D1BC845D39FA83

View file

@ -112,7 +112,7 @@ ENVVARS=(
"NNN_PREVIEWWIDTH=${NNN_PREVIEWWIDTH:-1920}" # width of generated preview images "NNN_PREVIEWWIDTH=${NNN_PREVIEWWIDTH:-1920}" # width of generated preview images
"NNN_PREVIEWHEIGHT=${NNN_PREVIEWHEIGHT:-1080}" # height 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_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 "NNN_PREVIEWVIDEO=${NNN_PREVIEWVIDEO:-}" # mpv backend used to preview video
) )
# Non-configurable environment variables # Non-configurable environment variables
@ -131,7 +131,7 @@ ENVVARS+=(
) )
trap '' PIPE trap '' PIPE
exists() { type "${1%% *}" >/dev/null 2>&1 ;} exists() { type "$1" >/dev/null 2>&1 ;}
pkill() { command pkill "$@" >/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" ;} prompt() { clear; printf "%b" "$@"; cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg" ;}
pidkill() { pidkill() {
@ -452,7 +452,7 @@ image_preview() {
wezterm imgcat "$3" & wezterm imgcat "$3" &
elif exists ueberzug && [[ "$NNN_PREVIEWIMGPROG" == +(|ueberzug) ]]; then elif exists ueberzug && [[ "$NNN_PREVIEWIMGPROG" == +(|ueberzug) ]]; then
ueberzug_layer "$1" "$2" "$3" && return 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" & "$NNN_PREVIEWIMGPROG" "$3" &
else else
fifo_pager print_bin_info "$3" && return fifo_pager print_bin_info "$3" && return