mirror of
https://github.com/jarun/nnn.git
synced 2024-11-04 18:33:12 +00:00
preview-tui-ext: reformat archive preview
This commit is contained in:
parent
47a779b1bf
commit
ec3f754192
|
@ -16,8 +16,7 @@
|
||||||
# - unzip
|
# - unzip
|
||||||
# - tar
|
# - tar
|
||||||
# - man
|
# - man
|
||||||
# - optional: bsdtar or atool for additional archive preview (make sure to export NNN_ARCHIVE
|
# - optional: bsdtar or atool for additional archive preview
|
||||||
# as suggested in the wiki: https://github.com/jarun/nnn/wiki/Usage#configuration)
|
|
||||||
# - 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
|
||||||
|
@ -78,7 +77,6 @@ USE_SCOPE="${USE_SCOPE:-0}"
|
||||||
USE_PISTOL="${USE_PISTOL:-0}"
|
USE_PISTOL="${USE_PISTOL:-0}"
|
||||||
ICONLOOKUP="${ICONLOOKUP:-0}"
|
ICONLOOKUP="${ICONLOOKUP:-0}"
|
||||||
PAGER="${PAGER:-less -P?n -R}"
|
PAGER="${PAGER:-less -P?n -R}"
|
||||||
ARCHIVES="$(echo "$NNN_ARCHIVE" | sed 's/.*(\(.*\)).*/\1/;s/|/ /g')"
|
|
||||||
TMPDIR="${TMPDIR:-/tmp}"
|
TMPDIR="${TMPDIR:-/tmp}"
|
||||||
# Consider setting NNN_PREVIEWDIR to $XDG_CACHE_DIR if you want to keep previews on disk between reboots
|
# Consider setting NNN_PREVIEWDIR to $XDG_CACHE_DIR if you want to keep previews on disk between reboots
|
||||||
NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR}/nnn/previews"
|
NNN_PREVIEWDIR="${NNN_PREVIEWDIR:-$TMPDIR}/nnn/previews"
|
||||||
|
@ -200,20 +198,21 @@ 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" ]; then
|
|
||||||
if exists bsdtar; then
|
|
||||||
fifo_pager bsdtar -tvf "$1"
|
|
||||||
elif exists atool; then
|
|
||||||
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
|
||||||
fifo_pager tar -tvf "$1"
|
fifo_pager tar -tvf "$1"
|
||||||
elif [ "$mimetype" = "application/x-rpm" ] || [ "$mimetype" = "application/vnd.debian.binary-package" ] && exists atool; then
|
|
||||||
fifo_pager atool -l "$1"
|
|
||||||
else
|
else
|
||||||
fifo_pager print_bin_info "$1"
|
case "$ext" in
|
||||||
|
7z|a|ace|alz|arc|arj|bz|cab|cpio|deb|jar|lha|lz|lzh|lzma|lzo\
|
||||||
|
|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z)
|
||||||
|
if exists atool; then
|
||||||
|
fifo_pager atool -l "$1"
|
||||||
|
elif exists bsdtar; then
|
||||||
|
fifo_pager bsdtar -tvf "$1"
|
||||||
|
fi ;;
|
||||||
|
*) fifo_pager print_bin_info "$1" ;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
elif [ "$ext" = "md" ]; then
|
elif [ "$ext" = "md" ]; then
|
||||||
if exists glow; then
|
if exists glow; then
|
||||||
|
|
Loading…
Reference in a new issue