]> Sergey Matveev's repositories - nnn.git/commitdiff
preview-tui: close previewer
authorLuuk van Baal <luukvbaal@gmail.com>
Thu, 22 Apr 2021 19:45:23 +0000 (21:45 +0200)
committerLuuk van Baal <luukvbaal@gmail.com>
Thu, 22 Apr 2021 19:45:23 +0000 (21:45 +0200)
plugins/preview-tui
plugins/preview-tui-ext

index 426526499a1d4ac049f441e9012e0b59ad6422c0..c16818d7ae5c07f348460c3d900936b9074452e6 100755 (executable)
@@ -273,6 +273,15 @@ if [ "$PREVIEW_MODE" ]; then
     exit 0
 fi
 
+if pgrep -f "cat $NNN_FIFO" >/dev/null; then
+    if exists QuickLook.exe && stat "$1" >/dev/null 2>&1; then
+        f="$(wslpath -w "$1" 2>&1)" && QuickLook.exe "$f" &
+    elif exists Bridge.exe && stat "$1" >/dev/null 2>&1; then
+        f="$(wslpath -w "$1" 2>&1)" && Bridge.exe "$f" &
+    fi
+    pkill -f "cat $NNN_FIO"
+    exit 0
+fi
 if [ "$TERMINAL" = "tmux" ]; then
     # tmux splits are inverted
     if [ "$SPLIT" = "v" ]; then SPLIT="h"; else SPLIT="v"; fi
index 25c5a3ec0c5559c078e5b1b8451367f9837800dc..31d6a9172faff34242a51b9cad4a599e79516fa4 100644 (file)
@@ -374,6 +374,15 @@ if [ "$PREVIEW_MODE" ]; then
     exit 0
 fi
 
+if pgrep -f "cat $NNN_FIFO" >/dev/null; then
+    if exists QuickLook.exe && stat "$1" >/dev/null 2>&1; then
+        f="$(wslpath -w "$1" 2>&1)" && QuickLook.exe "$f" &
+    elif exists Bridge.exe && stat "$1" >/dev/null 2>&1; then
+        f="$(wslpath -w "$1" 2>&1)" && Bridge.exe "$f" &
+    fi
+    pkill -f "cat $NNN_FIO"
+    exit 0
+fi
 if [ "$TERMINAL" = "tmux" ]; then
     # tmux splits are inverted
     if [ "$SPLIT" = "v" ]; then SPLIT="h"; else SPLIT="v"; fi