mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 20:01:27 +00:00
Add bsdtar for archives, w3m for html
This commit is contained in:
parent
fdf40df5e9
commit
4a45e45b30
|
@ -16,7 +16,7 @@
|
||||||
# - unzip
|
# - unzip
|
||||||
# - tar
|
# - tar
|
||||||
# - man
|
# - man
|
||||||
# - optional: atool for additional archive preview
|
# - optional: bsdtar or atool for additional archive preview
|
||||||
# - optional: bat for code syntax highlighting
|
# - optional: bat for code syntax highlighting
|
||||||
# - optional: ueberzug, kitty terminal, viu or catimg for images.
|
# - optional: ueberzug, kitty terminal, viu or catimg for images.
|
||||||
# - optional: convert(ImageMagick) for playing gif preview
|
# - optional: convert(ImageMagick) for playing gif preview
|
||||||
|
@ -26,6 +26,7 @@
|
||||||
# - optional: pdftoppm(poppler) for pdf thumbnails
|
# - optional: pdftoppm(poppler) for pdf thumbnails
|
||||||
# - optional: gnome-epub-thumbnailer for epub thumbnails (https://gitlab.gnome.org/GNOME/gnome-epub-thumbnailer)
|
# - optional: gnome-epub-thumbnailer for epub thumbnails (https://gitlab.gnome.org/GNOME/gnome-epub-thumbnailer)
|
||||||
# - optional: fontpreview for font preview (https://github.com/sdushantha/fontpreview)
|
# - optional: fontpreview for font preview (https://github.com/sdushantha/fontpreview)
|
||||||
|
# - optional: w3m for html
|
||||||
# - optional: scope.sh file viewer from ranger.
|
# - optional: scope.sh file viewer from ranger.
|
||||||
# To use:
|
# To use:
|
||||||
# 1. drop scope.sh executable in $PATH
|
# 1. drop scope.sh executable in $PATH
|
||||||
|
@ -181,8 +182,12 @@ preview_file () {
|
||||||
generate_preview "$cols" "$lines" "$1" "font"
|
generate_preview "$cols" "$lines" "$1" "font"
|
||||||
elif [ "${mimetype#*office}" != "$mimetype" ] || [ "${mimetype#*document}" != "$mimetype" ] && exists libreoffice; then
|
elif [ "${mimetype#*office}" != "$mimetype" ] || [ "${mimetype#*document}" != "$mimetype" ] && exists libreoffice; then
|
||||||
generate_preview "$cols" "$lines" "$1" "office"
|
generate_preview "$cols" "$lines" "$1" "office"
|
||||||
elif [ "${ARCHIVES#*$ext}" != "$ARCHIVES" ] && exists atool; then
|
elif [ "${ARCHIVES#*$ext}" != "$ARCHIVES" ]; then
|
||||||
|
if exists bsdtar; then
|
||||||
|
fifo_pager bsdtar -tvf "$1"
|
||||||
|
elif exists atool; then
|
||||||
fifo_pager atool -l "$1"
|
fifo_pager atool -l "$1"
|
||||||
|
fi
|
||||||
elif [ "$mimetype" = "application/zip" ]; then
|
elif [ "$mimetype" = "application/zip" ]; then
|
||||||
fifo_pager unzip -l "$1"
|
fifo_pager unzip -l "$1"
|
||||||
elif [ "$ext" = "gz" ] || [ "$ext" = "bz2" ]; then
|
elif [ "$ext" = "gz" ] || [ "$ext" = "bz2" ]; then
|
||||||
|
@ -190,6 +195,8 @@ preview_file () {
|
||||||
else
|
else
|
||||||
fifo_pager print_bin_info "$1"
|
fifo_pager print_bin_info "$1"
|
||||||
fi
|
fi
|
||||||
|
elif [ "$mimetype" = "text/html" ]; then
|
||||||
|
fifo_pager w3m "$1"
|
||||||
elif [ "$mimetype" = "text/troff" ]; then
|
elif [ "$mimetype" = "text/troff" ]; then
|
||||||
fifo_pager man -Pcat -l "$1"
|
fifo_pager man -Pcat -l "$1"
|
||||||
else
|
else
|
||||||
|
@ -204,7 +211,6 @@ preview_file () {
|
||||||
|
|
||||||
generate_preview() {
|
generate_preview() {
|
||||||
if [ ! -f "$TMPDIR/$3.png" ]; then
|
if [ ! -f "$TMPDIR/$3.png" ]; then
|
||||||
[ "$4" != gif ] && fifo_pager print_bin_info "$3"
|
|
||||||
mkdir -p "$TMPDIR/${3%/*}"
|
mkdir -p "$TMPDIR/${3%/*}"
|
||||||
case $4 in
|
case $4 in
|
||||||
audio) ffmpeg -i "$3" "$TMPDIR/$3.png" -y >/dev/null 2>&1 ;;
|
audio) ffmpeg -i "$3" "$TMPDIR/$3.png" -y >/dev/null 2>&1 ;;
|
||||||
|
|
Loading…
Reference in a new issue