aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-06-10 22:33:59 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2020-06-10 22:33:59 +0530
commitef0e9731345b020eccbb67d511d958bc92f7fb89 (patch)
treedaa2d196a1e44c615105bc88ee0d3956f8731132 /plugins
parent92ff1447c010b450b3dc4004e9976b972841003d (diff)
downloadnnn-ef0e9731345b020eccbb67d511d958bc92f7fb89.tar.gz
Add hx as alternative hex viewer
Diffstat (limited to 'plugins')
-rw-r--r--plugins/README.md2
-rwxr-xr-xplugins/hexview8
2 files changed, 7 insertions, 3 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 14eb976..9cdaa2a 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -41,7 +41,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
| [getplugs](getplugs) | Update plugins to installed `nnn` version | sh | curl |
| [gutenread](gutenread) | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional) |
| [gpg\*](gpg\*) | Encrypt/decrypt files using GPG | sh | gpg |
-| [hexview](hexview) | View a file in hex in `$PAGER` | sh | xxd |
+| [hexview](hexview) | View a file in hex in `$PAGER` | sh | [hx](https://github.com/krpors/hx)/xxd |
| [imgresize](imgresize) | Resize images in dir to screen resolution | sh | [imgp](https://github.com/jarun/imgp) |
| [imgthumb](imgthumb) | View thumbnail of an image or dir of images | sh | [lsix](https://github.com/hackerb9/lsix) |
| [imgur](imgur) | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) | bash | - |
diff --git a/plugins/hexview b/plugins/hexview
index 60b3428..ce17a60 100755
--- a/plugins/hexview
+++ b/plugins/hexview
@@ -1,11 +1,15 @@
#!/usr/bin/env sh
# Description: View a file in hex
-# Dependencies: xxd and $PAGER
+# Dependencies: hx (https://github.com/krpors/hx)/xxd and $PAGER
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
if ! [ -z "$1" ]; then
- xxd "$1" | $PAGER
+ if which hx >/dev/null 2>&1; then
+ hx "$1"
+ else
+ xxd "$1" | $PAGER
+ fi
fi