diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-09-29 09:19:44 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-09-29 09:19:44 +0530 |
commit | a25165d1bd3ecfac500a4649db7be5a8af9ee86d (patch) | |
tree | a4b1cea5da79bebff7a8e90777fa31dde2a73888 /plugins | |
parent | e8d5c453d702f912b1f3dbdec76af6a9f9612b9c (diff) | |
download | nnn-a25165d1bd3ecfac500a4649db7be5a8af9ee86d.tar.gz |
Fix directory view with viuimg
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/viuimg | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/viuimg b/plugins/viuimg index 8505be8..2659720 100755 --- a/plugins/viuimg +++ b/plugins/viuimg @@ -2,12 +2,25 @@ # 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. +# # Shell: POSIX compliant # Author: Arun Prakash Jana if ! [ -z "$1" ]; then if [ -d "$1" ]; then - viu -n "$1"/* 2>/dev/null | less -R + 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 |