]> Sergey Matveev's repositories - nnn.git/commitdiff
preview-tui-ext: pass env
authorLuuk van Baal <luukvbaal@gmail.com>
Sun, 18 Apr 2021 10:58:50 +0000 (12:58 +0200)
committerLuuk van Baal <luukvbaal@gmail.com>
Sun, 18 Apr 2021 10:58:50 +0000 (12:58 +0200)
plugins/preview-tui-ext

index 29554548c67cea5c46cf8ee79696d9c8a789c57b..a1f64b22d8d84831ec84ba5916547274bb6c71a3 100755 (executable)
@@ -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" &