]> Sergey Matveev's repositories - nnn.git/commitdiff
Add user script to view files in hex
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 23 Mar 2019 02:14:34 +0000 (07:44 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 23 Mar 2019 02:14:34 +0000 (07:44 +0530)
user-scripts/README.md
user-scripts/hexview [new file with mode: 0755]

index f4589e98af93dbb609eddcc8104f73c3d09ca054..08f7a5a470af5c82542c279e06cd56e716476c7e 100644 (file)
@@ -5,6 +5,7 @@
 | copier | Copy selection to clipboard |
 | edit | Fuzzy find a file in directory subtree with fzy and edit in vim |
 | fzy | Fuzzy find a file in directory subtree with fzy and open using xdg-open |
+| hexview | view a file in hex; needs xxd and $PAGER |
 | imgur | Upload an image file to imgur |
 | kdeconnect | Send selected files to Android device using kdeconnect-cli |
 | ndiff | File and directory diff for selection using vimdiff |
diff --git a/user-scripts/hexview b/user-scripts/hexview
new file mode 100755 (executable)
index 0000000..5125fa3
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+# Description: View a file in hex
+# Requires: xxd and $PAGER
+#
+# Shell: POSIX compliant
+# Author: Arun Prakash Jana
+
+if ! [ -z "$1" ]; then
+    xxd "$1" | "$PAGER"
+fi