preview-tui-ext: pass env

This commit is contained in:
Luuk van Baal 2021-04-18 12:58:50 +02:00
parent e09148e386
commit 14350b94a8

View file

@ -168,7 +168,7 @@ preview_file() {
if [ -d "$1" ]; then
cd "$1" || return
if exists tree; then
if [ "$ICONLOOKUP" -ne 0 ]; then
if [ "$ICONLOOKUP" -ne 0 ] && [ -f "$(dirname "$0")"/.iconlookup ]; then
[ "$SPLIT" = h ] && BSTR="\n"
tree -L 1 --dirsfirst -F --noreport -i | head -n "$((lines - 3))" | "$(dirname "$0")"/.iconlookup -l "$cols" -B "$BSTR" -b " "
else
@ -183,7 +183,7 @@ preview_file() {
if [ "${mimetype%%/*}" = "image" ]; then
if [ "${mimetype#*/}" = "gif" ] && exists convert; then
generate_preview "$cols" "$lines" "$1" "gif"
elif [ ! "${mimetype#*/}" = "jpeg" ]; then
elif [ "${mimetype#*/}" != "jpeg" ]; then
generate_preview "$cols" "$lines" "$1" "image"
else
image_preview "$cols" "$lines" "$1"
@ -366,7 +366,9 @@ if [ "$TERMINAL" = "tmux" ]; then
# tmux splits are inverted
if [ "$SPLIT" = "v" ]; then SPLIT="h"; else SPLIT="v"; fi
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -e "SPLIT=$SPLIT" -d"$SPLIT" "$0" "$1"
tmux split-window -e "NNN_FIFO=$NNN_FIFO" -e "PREVIEW_MODE=1" -e "PAGER=$PAGER" \
-e "USE_SCOPE=$USE_SCOPE" -e "SPLIT=$SPLIT" -e "USE_PISTOL=$USE_PISTOL" \
-e "ICONLOOKUP=$ICONLOOKUP" -d"$SPLIT" "$0" "$1"
elif [ "$TERMINAL" = "kitty" ]; then
# Setting the layout for the new window. It will be restored after the
# script ends.
@ -379,7 +381,7 @@ elif [ "$TERMINAL" = "kitty" ]; then
--cwd "$PWD" --env "PATH=$PATH" --env "NNN_FIFO=$NNN_FIFO" \
--env "PREVIEW_MODE=1" --env "PAGER=$PAGER" \
--env "USE_SCOPE=$USE_SCOPE" --env "SPLIT=$SPLIT" \
--env "USE_PISTOL=$USE_PISTOL" \
--env "USE_PISTOL=$USE_PISTOL" --env "ICONLOOKUP=$ICONLOOKUP" \
--location "${SPLIT}split" "$0" "$1" >/dev/null
else
PREVIEW_MODE=1 $TERMINAL -e "$0" "$1" &