@@ -65,7 +65,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. | |||||
## Invoking a plugin | ## Invoking a plugin | ||||
Use the plugin shortcut (<kbd>;key</kbd> or <kbd>^Pkey</kbd>) to list the defined plugin keys and press the required key. E.g., with the below config: | |||||
Use the plugin shortcut (<kbd>;key</kbd> or <kbd>^Skey</kbd>) 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' | ||||
@@ -1571,7 +1571,7 @@ static bool cpmvrm_selection(enum action sel, char *path, int *presel) | |||||
return FALSE; | return FALSE; | ||||
} | } | ||||
break; | break; | ||||
default: /* SEL_RMMUL */ | |||||
default: /* SEL_RM */ | |||||
rmmulstr(g_buf); | rmmulstr(g_buf); | ||||
break; | break; | ||||
} | } | ||||
@@ -3606,7 +3606,7 @@ static void show_help(const char *path) | |||||
"9Up k Up%-16cPgUp ^U Scroll up\n" | "9Up k Up%-16cPgUp ^U Scroll up\n" | ||||
"9Dn j Down%-14cPgDn ^D Scroll down\n" | "9Dn j Down%-14cPgDn ^D Scroll down\n" | ||||
"9Lt h Parent%-12c~ ` @ - HOME, /, start, last\n" | "9Lt h Parent%-12c~ ` @ - HOME, /, start, last\n" | ||||
"5Ret Rt l Open%-20cf First file\n" | |||||
"5Ret Rt l Open%-20c' First file\n" | |||||
"9g ^A Top%-21c. Toggle hidden\n" | "9g ^A Top%-21c. Toggle hidden\n" | ||||
"9G ^E End%-21c0 Lock terminal\n" | "9G ^E End%-21c0 Lock terminal\n" | ||||
"9b ^/ Bookmark key%-12c, Pin CWD\n" | "9b ^/ Bookmark key%-12c, Pin CWD\n" | ||||
@@ -3616,20 +3616,19 @@ static void show_help(const char *path) | |||||
"c? Help, conf%-13c^G QuitCD\n" | "c? Help, conf%-13c^G QuitCD\n" | ||||
"9Q ^Q Quit%-20cq Quit context\n" | "9Q ^Q Quit%-20cq Quit context\n" | ||||
"1FILES\n" | "1FILES\n" | ||||
"b^O Open with...%-12cn Create new/link\n" | |||||
"b^F File details%-12cd Detail view toggle\n" | |||||
"9o ^O Open with...%-12cn Create new/link\n" | |||||
"9f ^F File details%-12cd Detail view toggle\n" | |||||
"b^R Rename/dup%-14cr Batch rename\n" | "b^R Rename/dup%-14cr Batch rename\n" | ||||
"cz Archive entry%-11c* Toggle exe\n" | |||||
"cz Archive%-17c* Toggle exe\n" | |||||
"5Space ^J (Un)select%-11cm ^K Mark range/clear\n" | "5Space ^J (Un)select%-11cm ^K Mark range/clear\n" | ||||
"cp Copy sel here%-11ca Select all\n" | |||||
"cv Move sel here%-10c^V Copy/move sel as\n" | |||||
"cx Delete sel%-13c^X Delete entry\n" | |||||
"9o ^T Sort toggles%-12ce Edit sel\n" | |||||
"9p ^P Copy sel here%-11ca Select all\n" | |||||
"9v ^V Move sel here%-8cw ^W Copy/move sel as\n" | |||||
"9x ^X Delete%-18ce Edit sel\n" | |||||
"1MISC\n" | "1MISC\n" | ||||
"9; ^P Plugin%-18c= Launch app\n" | |||||
"9; ^S Select plugin%-11c= Launch app\n" | |||||
"9! ^] Shell%-19c] Cmd prompt\n" | "9! ^] Shell%-19c] Cmd prompt\n" | ||||
"cs Manage session%-10cu Unmount\n" | |||||
"cc Connect remote%-0c\n" | |||||
"cc Connect remote%-10cu Unmount\n" | |||||
"9t ^T Sort toggles%-12cs Manage session\n" | |||||
}; | }; | ||||
fd = create_tmp_file(); | fd = create_tmp_file(); | ||||
@@ -5240,8 +5239,30 @@ nochange: | |||||
case SEL_CP: // fallthrough | case SEL_CP: // fallthrough | ||||
case SEL_MV: // fallthrough | case SEL_MV: // fallthrough | ||||
case SEL_CPMVAS: // fallthrough | case SEL_CPMVAS: // fallthrough | ||||
case SEL_RMMUL: | |||||
case SEL_RM: | |||||
{ | { | ||||
if (sel == SEL_RM) { | |||||
r = get_cur_or_sel(); | |||||
if (!r) { | |||||
statusbar(path); | |||||
goto nochange; | |||||
} | |||||
if (r == 'c') { | |||||
mkpath(path, dents[cur].name, newpath); | |||||
xrm(newpath); | |||||
if (cur && access(newpath, F_OK) == -1) { | |||||
move_cursor(cur - 1, 0); | |||||
copycurname(); | |||||
} | |||||
if (cfg.filtermode) | |||||
presel = FILTER; | |||||
goto begin; | |||||
} | |||||
} | |||||
endselection(); | endselection(); | ||||
if (!cpmvrm_selection(sel, path, &presel)) | if (!cpmvrm_selection(sel, path, &presel)) | ||||
@@ -5257,25 +5278,6 @@ nochange: | |||||
copycurname(); | copycurname(); | ||||
goto begin; | goto begin; | ||||
} | } | ||||
case SEL_RM: | |||||
{ | |||||
if (!ndents) | |||||
break; | |||||
mkpath(path, dents[cur].name, newpath); | |||||
xrm(newpath); | |||||
if (cur && access(newpath, F_OK) == -1) | |||||
move_cursor(cur - 1, 0); | |||||
/* We reduce cur only if it is > 0, so it's at least 0 */ | |||||
copycurname(); | |||||
if (cfg.filtermode) | |||||
presel = FILTER; | |||||
goto begin; | |||||
} | |||||
case SEL_ARCHIVE: // fallthrough | case SEL_ARCHIVE: // fallthrough | ||||
case SEL_OPENWITH: // fallthrough | case SEL_OPENWITH: // fallthrough | ||||
case SEL_NEW: // fallthrough | case SEL_NEW: // fallthrough | ||||
@@ -76,7 +76,6 @@ enum action { | |||||
SEL_CP, | SEL_CP, | ||||
SEL_MV, | SEL_MV, | ||||
SEL_CPMVAS, | SEL_CPMVAS, | ||||
SEL_RMMUL, | |||||
SEL_RM, | SEL_RM, | ||||
SEL_OPENWITH, | SEL_OPENWITH, | ||||
SEL_NEW, | SEL_NEW, | ||||
@@ -136,7 +135,7 @@ static struct key bindings[] = { | |||||
{ 'G', SEL_END }, | { 'G', SEL_END }, | ||||
{ CONTROL('E'), SEL_END }, | { CONTROL('E'), SEL_END }, | ||||
/* Go to first file */ | /* Go to first file */ | ||||
{ 'f', SEL_FIRST }, | |||||
{ '\'', SEL_FIRST }, | |||||
/* HOME */ | /* HOME */ | ||||
{ '~', SEL_CDHOME }, | { '~', SEL_CDHOME }, | ||||
/* Initial directory */ | /* Initial directory */ | ||||
@@ -168,13 +167,14 @@ static struct key bindings[] = { | |||||
/* Detailed listing */ | /* Detailed listing */ | ||||
{ 'd', SEL_DETAIL }, | { 'd', SEL_DETAIL }, | ||||
/* File details */ | /* File details */ | ||||
{ 'f', SEL_STATS }, | |||||
{ CONTROL('F'), SEL_STATS }, | { CONTROL('F'), SEL_STATS }, | ||||
/* Toggle executable status */ | /* Toggle executable status */ | ||||
{ '*', SEL_CHMODX }, | { '*', SEL_CHMODX }, | ||||
/* Create archive */ | /* Create archive */ | ||||
{ 'z', SEL_ARCHIVE }, | { 'z', SEL_ARCHIVE }, | ||||
/* Order toggle */ | |||||
{ 'o', SEL_ORDER }, | |||||
/* Sort toggles */ | |||||
{ 't', SEL_ORDER }, | |||||
{ CONTROL('T'), SEL_ORDER }, | { CONTROL('T'), SEL_ORDER }, | ||||
/* Redraw window */ | /* Redraw window */ | ||||
{ CONTROL('L'), SEL_REDRAW }, | { CONTROL('L'), SEL_REDRAW }, | ||||
@@ -190,15 +190,18 @@ static struct key bindings[] = { | |||||
{ 'e', SEL_SELEDIT }, | { 'e', SEL_SELEDIT }, | ||||
/* Copy from selection buffer */ | /* Copy from selection buffer */ | ||||
{ 'p', SEL_CP }, | { 'p', SEL_CP }, | ||||
{ CONTROL('P'), SEL_CP }, | |||||
/* Move from selection buffer */ | /* Move from selection buffer */ | ||||
{ 'v', SEL_MV }, | { 'v', SEL_MV }, | ||||
{ CONTROL('V'), SEL_MV }, | |||||
/* Copy/move from selection buffer and rename */ | /* Copy/move from selection buffer and rename */ | ||||
{ CONTROL('V'), SEL_CPMVAS }, | |||||
{ 'w', SEL_CPMVAS }, | |||||
{ CONTROL('W'), SEL_CPMVAS }, | |||||
/* Delete from selection buffer */ | /* Delete from selection buffer */ | ||||
{ 'x', SEL_RMMUL }, | |||||
/* Delete currently selected */ | |||||
{ 'x', SEL_RM }, | |||||
{ CONTROL('X'), SEL_RM }, | { CONTROL('X'), SEL_RM }, | ||||
/* Open in a custom application */ | /* Open in a custom application */ | ||||
{ 'o', SEL_OPENWITH }, | |||||
{ CONTROL('O'), SEL_OPENWITH }, | { CONTROL('O'), SEL_OPENWITH }, | ||||
/* Create a new file */ | /* Create a new file */ | ||||
{ 'n', SEL_NEW }, | { 'n', SEL_NEW }, | ||||
@@ -214,7 +217,7 @@ static struct key bindings[] = { | |||||
{ '?', SEL_HELP }, | { '?', SEL_HELP }, | ||||
/* Run a plugin */ | /* Run a plugin */ | ||||
{ ';', SEL_PLUGIN }, | { ';', SEL_PLUGIN }, | ||||
{ CONTROL('P'), SEL_PLUGIN }, | |||||
{ CONTROL('S'), SEL_PLUGIN }, | |||||
/* Run command */ | /* Run command */ | ||||
{ '!', SEL_SHELL }, | { '!', SEL_SHELL }, | ||||
{ CONTROL(']'), SEL_SHELL }, | { CONTROL(']'), SEL_SHELL }, | ||||