aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/README.md19
-rwxr-xr-xplugins/autojump23
2 files changed, 35 insertions, 7 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 07aa7a8..772f28e 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -16,7 +16,7 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
| Plugin (a-z) | Description | Lang | Dependencies |
| --- | --- | --- | --- |
-| [autojump](autojump) | Navigate to dir/path | sh | [jump](https://github.com/gsamokovarov/jump)/autojump |
+| [autojump](autojump) | Navigate to dir/path | sh | [jump](https://github.com/gsamokovarov/jump)/autojump/zoxide |
| [bookmarks](bookmarks) | Use named bookmarks managed with symlinks | sh | fzf |
| [boom](boom) | Play random music from dir | sh | [moc](http://moc.daper.net/) |
| [bulknew](bulknew) | Create multiple files/dirs at once | bash | sed, xargs, mktemp |
@@ -94,6 +94,23 @@ To pick and run an unassigned plugin, press <kbd>Enter</kbd> (to _enter_ the plu
To run a plugin at startup, use the option `-P` followed by the plugin key.
+If the plugins list gets too long, try breaking them up into sections:
+
+```
+NNN_PLUG_PERSONAL='g:personal/convert2zoom;p:personal/echo'
+NNN_PLUG_WORK='j:work/prettyjson;d:work/foobar'
+NNN_PLUG_INLINE='e:_go run $nnn*'
+NNN_PLUG_DEFAULT='1:bookmarks;2:ipinfo;p:preview-tui;o:fzz;b:nbak'
+NNN_PLUG="$NNN_PLUG_PERSONAL;$NNN_PLUG_WORK;$NNN_PLUG_DEFAULT;$NNN_PLUG_INLINE"
+export NNN_PLUG
+```
+
+Note:
+- `'g:personal/convert2zoom'` will look in the personal sub-folder inside the plugin folder.
+- `'b:boom;b:bookmarks` will result in only the first definition of *b* (`b:boom`) being used.
+- A keybinding definition of more than 1 character will prevent nnn from starting.
+
+
#### Skip directory refresh after running a plugin
`nnn` refreshes the directory after running a plugin to reflect any changes by the plugin. To disable this (say while running the `mediainf` plugin on some filtered files), add a `-` before the plugin name:
diff --git a/plugins/autojump b/plugins/autojump
index 3bfe228..db10c84 100755
--- a/plugins/autojump
+++ b/plugins/autojump
@@ -1,14 +1,15 @@
#!/usr/bin/env sh
-# Description: Navigate to directory using jump/autojump
+# Description: Navigate to directory using jump/autojump/zoxide
#
# Dependencies: jump - https://github.com/gsamokovarov/jump
# OR autojump - https://github.com/wting/autojump
+# OR zoxide - https://github.com/ajeetdsouza/zoxide
#
-# Note: jump/autojump STORES NAVIGATION PATTERNS
+# Note: The dependencies STORE NAVIGATION PATTERNS
#
# Shell: POSIX compliant
-# Authors: Marty Buchaus, Dave Snider
+# Authors: Marty Buchaus, Dave Snider, Tim Adler
if [ -z "$NNN_PIPE" ]; then
echo 'ERROR: NNN_PIPE is not set' | ${PAGER:-less}
@@ -16,16 +17,26 @@ if [ -z "$NNN_PIPE" ]; then
fi
if which jump >/dev/null 2>&1; then
- printf "jump to: "
+ printf "jump to : "
read -r dir
odir="$(jump cd "$dir")"
printf "%s" "0c$odir" > "$NNN_PIPE"
elif which autojump >/dev/null 2>&1; then
- printf "jump to: "
+ printf "jump to : "
read -r dir
odir="$(autojump "$dir")"
printf "%s" "0c$odir" > "$NNN_PIPE"
+elif which zoxide >/dev/null 2>&1; then
+ if which fzf >/dev/null 2>&1; then
+ odir="$(zoxide query -i --)"
+ printf "%s" "0c$odir" > "$NNN_PIPE"
+ else
+ printf "jump to : "
+ read -r dir
+ odir="$(zoxide query -- "$dir")"
+ printf "%s" "0c$odir" > "$NNN_PIPE"
+ fi
else
- printf "jump/autojump missing"
+ printf "No supported autojump script found. (jump/autojump/zoxide are supported)"
read -r _
fi