plugins/README.md | 12 ++++++------
src/nnn.c | 21 ++++++++++-----------
src/nnn.h | 5 +----
diff --git a/plugins/README.md b/plugins/README.md
index 853c5d7ba5fe226f8e9acaf67726fd54deb61fc8..3268c388729fa8af97373dcee73920222a540586 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -63,19 +63,19 @@ | upload | Paste text to ix.io, upload binary to file.io | sh | curl, jq, tr |
| vidthumb | Show video thumbnails in terminal | sh | [ffmpegthumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer),
[lsix](https://github.com/hackerb9/lsix) |
| wall | Set wallpaper or change colorscheme | sh | nitrogen/pywal |
-## Ways to invoke a plugin
+## Invoking a plugin
-1. Fire directly with ;key or ^Fkey:
+Use the plugin shortcut (;key or ;key) to list the defined plugin keys and press the required key. E.g., with the below config:
- export NNN_PLUG='o:fzopen;p:mocplay;d:diffs;m:nmount;n:notes;v:imgviu;t:imgthumb'
+ export NNN_PLUG='o:fzopen;p:mocplay;d:diffs;m:nmount;n:notes;v:imgviu;t:imgthumb'
- Now plugin `fzopen` can be run with the keybind ;o, `mocplay` can be run with ;p and so on... The key vs. plugin pairs are shown in the help and config screen.
+ Plugin `fzopen` can be run with the keybind ;o, `mocplay` can be run with ;p and so on... The key vs. plugin pairs are shown in the help and config screen.
-2. Use the _pick plugin_ keybind to visit the plugin directory, select and run a plugin. Repeat the keybind to cancel and return to the original directory.
+A maximum of 15 keys can be defined. To select and invoke a plugin from the plugin directory, press Enter (to _enter_ the plugin dir) after the plugin shortcut.
#### Skip directory refresh after running a plugin
-`nnn` refreshes a directory after running a plugin by key (method 1 above) to reflect any changes by the plugin. To disable this (say while running the `mediainfo` plugin on some filtered files), add a `-` before the plugin name:
+`nnn` refreshes the directory after running a plugin to reflect any changes by the plugin. To disable this (say while running the `mediainfo` plugin on some filtered files), add a `-` before the plugin name:
export NNN_PLUG='m:-mediainfo'
diff --git a/src/nnn.c b/src/nnn.c
index 8a437b21f2e6c0845f56ce47650b683630fa0de5..fb8a6d59c1eae6a45185f4138ce6f9992ff9f102 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -3613,10 +3613,10 @@ "cV Move sel here%-10c^V Copy/move sel as\n"
"cX Delete sel%-13c^X Delete entry\n"
"9o ^T Order toggle%-11c^Y List, edit sel\n"
"1MISC\n"
- "9! ^] Shell%-16c; ^F Fire plugin\n"
- "c] Cmd prompt%-13c^P Pick plugin\n"
- "cs Manage session%-10c= Launch app\n"
- "cc Connect remote%-10cu Unmount\n"
+ "9; ^P Plugin%-18c= Launch app\n"
+ "9! ^] Shell%-19c] Cmd prompt\n"
+ "cs Manage session%-10cu Unmount\n"
+ "cc Connect remote%-0c\n"
};
fd = create_tmp_file();
@@ -5477,7 +5477,6 @@ }
goto begin;
}
- case SEL_PLUGKEY: // fallthrough
case SEL_PLUGIN:
/* Check if directory is accessible */
if (!xdiraccess(plugindir)) {
@@ -5485,12 +5484,12 @@ printwarn(&presel);
goto nochange;
}
- if (sel == SEL_PLUGKEY) {
+ r = xstrlcpy(g_buf, messages[MSG_PLUGIN_KEYS], CMD_LEN_MAX);
+ printkeys(plug, g_buf + r - 1, PLUGIN_MAX);
+ printprompt(g_buf);
+ r = get_input(NULL);
+ if (r != '\r') {
endselection();
- r = xstrlcpy(g_buf, messages[MSG_PLUGIN_KEYS], CMD_LEN_MAX);
- printkeys(plug, g_buf + r - 1, PLUGIN_MAX);
- printprompt(g_buf);
- r = get_input(NULL);
tmp = get_kv_val(plug, NULL, r, PLUGIN_MAX, FALSE);
if (!tmp) {
printwait(messages[MSG_INVALID_KEY], &presel);
@@ -5517,7 +5516,7 @@ }
if (ndents)
copycurname();
- } else {
+ } else { /* 'Return/Enter' enters the plugin directory */
cfg.runplugin ^= 1;
if (!cfg.runplugin && rundir[0]) {
/*
diff --git a/src/nnn.h b/src/nnn.h
index b0e712b4d73695a342d5c51425c0198737e72bcf..f1cb5500b961835cd46372f73044f735b3f20ad7 100644
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -85,7 +85,6 @@ SEL_RENAMEMUL,
SEL_REMOTE,
SEL_UMOUNT,
SEL_HELP,
- SEL_PLUGKEY,
SEL_PLUGIN,
SEL_SHELL,
SEL_LAUNCH,
@@ -217,10 +216,8 @@ /* Disconnect a SSHFS mount point */
{ 'u', SEL_UMOUNT },
/* Show help */
{ '?', SEL_HELP },
- /* Plugin key */
- { ';', SEL_PLUGKEY },
- { CONTROL('F'), SEL_PLUGKEY },
/* Run a plugin */
+ { ';', SEL_PLUGIN },
{ CONTROL('P'), SEL_PLUGIN },
/* Run command */
{ '!', SEL_SHELL },