]> Sergey Matveev's repositories - nnn.git/commitdiff
Update plugin viuimg
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 1 Oct 2019 02:05:54 +0000 (07:35 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 1 Oct 2019 02:05:54 +0000 (07:35 +0530)
plugins/README.md
plugins/viuimg

index 952b8f571551dfe8505d66e428b6248bbaaf6af7..976348fab6a149c8778f18500e6a4475a25114f2 100644 (file)
@@ -40,7 +40,7 @@ The currently available plugins are listed below.
 | transfer | sh | curl | Upload file to transfer.sh |
 | upgrade | sh | curl | Upgrade nnn manually on Debian 9 Stretch |
 | vidthumb | sh | [ffmpegthumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer),<br>[lsix](https://github.com/hackerb9/lsix) | Show video thumbnails in terminal |
-| viuimg | sh | [viu](https://github.com/atanunq/viu), less | View an image or images in dir |
+| viuimg | sh | [viu](https://github.com/atanunq/viu), less | View an image or images in dir in `$PAGER` |
 
 ## Installing plugins
 
@@ -56,7 +56,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. You ca
 
 **Method 1:** Directly with <kbd>:key</kbd>:
 
-    export NNN_PLUG='o:fzy-open;p:mocplay;d:ndiff;m:nmount;n:notes;t:thumb'
+    export NNN_PLUG='o:fzy-open;p:mocplay;d:ndiff;m:nmount;n:notes;v:viuimg;t:thumb'
 
 With this, plugin `fzy-open` can be run with the keybind <kbd>:o</kbd>, `mocplay` can be run with <kbd>:p</kbd> and so on... The key vs. plugin pairs are shown in the help and config screen. Up to 10 plugins can have such keybinds.
 
index 26597207162dfa386507b2cb281f026378b71a33..200a4591cb1e5ab1213933deb602d57930760b2a 100755 (executable)
@@ -1,27 +1,10 @@
 #!/usr/bin/env sh
 
-# Description: View an image or images in a directory in pager
-#
-# Note: While it's very easy to fix this in Bash (sample commented),  with the
-#       current POSIX shell script implementation the unmatched patterns are spewed.
-#       A patch to fix this is highly appreciated.
+# Description: View an image or images in a directory in $PAGER
 #
 # Shell: POSIX compliant
 # Author: Arun Prakash Jana
 
 if ! [ -z "$1" ]; then
-    if [ -d "$1" ]; then
-        cd "$1"
-
-        # Bash implementation
-        # shopt -s nullglob
-        # viu -n *.bmp *.BMP *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.svg *.SVG 2>/dev/null | less -R
-
-        for file in *.bmp *.BMP *.gif *.GIF *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.svg *.SVG
-        do
-            viu -n "$file" 2>/dev/null
-        done | less -R
-    else
-        viu -n "$1" | less -R
-    fi
+    viu -n "$1" | less -R
 fi