Add hx as alternative hex viewer

This commit is contained in:
Arun Prakash Jana 2020-06-10 22:33:59 +05:30
parent 92ff1447c0
commit ef0e973134
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 7 additions and 3 deletions

View 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 | - |

View File

@ -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