mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Combine list, edit selection. Key ^Y
This commit is contained in:
parent
749f089355
commit
3d7cc30441
2 changed files with 24 additions and 21 deletions
40
src/nnn.c
40
src/nnn.c
|
@ -474,6 +474,7 @@ static char * const utils[] = {
|
||||||
#define MSG_BOOKMARK_KEYS 36
|
#define MSG_BOOKMARK_KEYS 36
|
||||||
#define MSG_INVALID_REG 37
|
#define MSG_INVALID_REG 37
|
||||||
#define MSG_ORDER 38
|
#define MSG_ORDER 38
|
||||||
|
#define MSG_EDIT_SEL 39
|
||||||
|
|
||||||
static const char * const messages[] = {
|
static const char * const messages[] = {
|
||||||
"no traversal",
|
"no traversal",
|
||||||
|
@ -515,6 +516,7 @@ static const char * const messages[] = {
|
||||||
"bookmark keys:",
|
"bookmark keys:",
|
||||||
"invalid regex",
|
"invalid regex",
|
||||||
"toggle 'a'u / 'd'u / 'e'xtn / 'r'everse / 's'ize / 't'ime / 'v'ersion?",
|
"toggle 'a'u / 'd'u / 'e'xtn / 'r'everse / 's'ize / 't'ime / 'v'ersion?",
|
||||||
|
"edit sel?",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Supported configuration environment variables */
|
/* Supported configuration environment variables */
|
||||||
|
@ -3609,8 +3611,7 @@ static void show_help(const char *path)
|
||||||
"cP Copy sel here%-11ca Select all\n"
|
"cP Copy sel here%-11ca Select all\n"
|
||||||
"cV Move sel here%-10c^V Copy/move sel as\n"
|
"cV Move sel here%-10c^V Copy/move sel as\n"
|
||||||
"cX Delete sel%-13c^X Delete entry\n"
|
"cX Delete sel%-13c^X Delete entry\n"
|
||||||
"cy List sel%-15c^Y Edit sel\n"
|
"9o ^T Order toggle%-11c^Y List, edit sel\n"
|
||||||
"9o ^T Order toggle%-0c\n"
|
|
||||||
"1MISC\n"
|
"1MISC\n"
|
||||||
"9! ^] Shell%-16c; ^F Fire plugin\n"
|
"9! ^] Shell%-16c; ^F Fire plugin\n"
|
||||||
"c] Cmd prompt%-13c^P Pick plugin\n"
|
"c] Cmd prompt%-13c^P Pick plugin\n"
|
||||||
|
@ -5223,23 +5224,28 @@ nochange:
|
||||||
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
||||||
continue;
|
continue;
|
||||||
case SEL_SELLIST:
|
case SEL_SELLIST:
|
||||||
if (listselbuf() || listselfile()) {
|
if (!listselbuf() && !listselfile()) {
|
||||||
if (cfg.filtermode)
|
printwait(messages[MSG_0_SELECTED], &presel);
|
||||||
presel = FILTER;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printwait(messages[MSG_0_SELECTED], &presel);
|
|
||||||
goto nochange;
|
|
||||||
case SEL_SELEDIT:
|
|
||||||
r = editselection();
|
|
||||||
if (r <= 0) {
|
|
||||||
const char *msg
|
|
||||||
= (!r ? messages[MSG_0_SELECTED] : messages[MSG_FAILED]);
|
|
||||||
printwait(msg, &presel);
|
|
||||||
goto nochange;
|
goto nochange;
|
||||||
} else if (cfg.x11)
|
}
|
||||||
|
|
||||||
|
r = get_input(messages[MSG_EDIT_SEL]);
|
||||||
|
if (r != 'y' && r != 'Y') {
|
||||||
|
cfg.filtermode ? presel = FILTER : statusbar(path);
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = editselection();
|
||||||
|
if (r <= 0) { /* Cannot be equal to 0 though as listing guards */
|
||||||
|
printwait(messages[MSG_FAILED], &presel);
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfg.x11)
|
||||||
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
plugscript(utils[UTIL_CBCP], newpath, F_NOWAIT | F_NOTRACE);
|
||||||
break;
|
|
||||||
|
cfg.filtermode ? presel = FILTER : statusbar(path);
|
||||||
|
goto 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
|
||||||
|
|
|
@ -73,7 +73,6 @@ enum action {
|
||||||
SEL_SELMUL,
|
SEL_SELMUL,
|
||||||
SEL_SELALL,
|
SEL_SELALL,
|
||||||
SEL_SELLIST,
|
SEL_SELLIST,
|
||||||
SEL_SELEDIT,
|
|
||||||
SEL_CP,
|
SEL_CP,
|
||||||
SEL_MV,
|
SEL_MV,
|
||||||
SEL_CPMVAS,
|
SEL_CPMVAS,
|
||||||
|
@ -191,10 +190,8 @@ static struct key bindings[] = {
|
||||||
{ CONTROL('K'), SEL_SELMUL },
|
{ CONTROL('K'), SEL_SELMUL },
|
||||||
/* Select all files in current dir */
|
/* Select all files in current dir */
|
||||||
{ 'a', SEL_SELALL },
|
{ 'a', SEL_SELALL },
|
||||||
/* Show list of copied files */
|
/* List, edit selection */
|
||||||
{ 'y', SEL_SELLIST },
|
{ 'y', SEL_SELLIST },
|
||||||
/* Edit selection buffer */
|
|
||||||
{ CONTROL('Y'), SEL_SELEDIT },
|
|
||||||
/* Copy from selection buffer */
|
/* Copy from selection buffer */
|
||||||
{ 'P', SEL_CP },
|
{ 'P', SEL_CP },
|
||||||
/* Move from selection buffer */
|
/* Move from selection buffer */
|
||||||
|
|
Loading…
Add table
Reference in a new issue