]> Sergey Matveev's repositories - nnn.git/commitdiff
Add hx as alternative hex viewer
authorArun Prakash Jana <engineerarun@gmail.com>
Wed, 10 Jun 2020 17:03:59 +0000 (22:33 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Wed, 10 Jun 2020 17:03:59 +0000 (22:33 +0530)
plugins/README.md
plugins/hexview

index 14eb976549f9d2c950743cc92c195bfbc585a372..9cdaa2a3740cbbbcab368ba846bd502c7e5abbf0 100644 (file)
@@ -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 | - |
index 60b342817b664cabfd99e14fb502ed0fe4f1811c..ce17a60d39ef39a2260c7a7298338b50e6aa88f3 100755 (executable)
@@ -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