From ef09f427209eab13c65d8abe986d67bd9b38a33d Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Tue, 10 Dec 2019 22:29:15 +0530 Subject: [PATCH] PR #399: add autojump plugin --- plugins/README.md | 1 + plugins/autojump | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100755 plugins/autojump diff --git a/plugins/README.md b/plugins/README.md index 4bf724b1..62270c0e 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -14,6 +14,7 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina | Plugin (a-z) | Description | Lang | Deps | | --- | --- | --- | --- | +| autojump | Navigate to dir/path | sh | autojump | | boom | Play random music from dir | sh | [moc](http://moc.daper.net/) | | dups | List non-empty duplicate files in current dir | sh | find, md5sum,
sort uniq xargs | | chksum | Create and verify checksums | sh | md5sum,
sha256sum | diff --git a/plugins/autojump b/plugins/autojump new file mode 100755 index 00000000..d1581139 --- /dev/null +++ b/plugins/autojump @@ -0,0 +1,17 @@ +#!/usr/bin/env sh + +# Description: Navigate to directory using autojump +# +# Requires: autojump - https://github.com/wting/autojump +# +# Shell: POSIX compliant +# Author: Marty Buchaus + +if which autojump >/dev/null 2>&1; then + printf "jump to: " + read -r dir + odir="$(autojump "$dir")" + printf "%s" "0$odir" > "$NNN_PIPE" +else + exit 1 +fi