mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Support select all with Y
This commit is contained in:
parent
b7666a8d5c
commit
ebc81c5d34
4 changed files with 33 additions and 13 deletions
|
@ -95,7 +95,7 @@ It runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows
|
||||||
- Media information (needs mediainfo/exiftool)
|
- Media information (needs mediainfo/exiftool)
|
||||||
- Convenience
|
- Convenience
|
||||||
- Create, rename files and directories
|
- Create, rename files and directories
|
||||||
- Select files across directories, range selection
|
- Select files across dirs; all/range selection
|
||||||
- Copy, move, delete selection
|
- Copy, move, delete selection
|
||||||
- Create sym/hard link(s) to selection
|
- Create sym/hard link(s) to selection
|
||||||
- Transfer files using lftp
|
- Transfer files using lftp
|
||||||
|
@ -231,7 +231,8 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
||||||
^O Open with... n Create new/link
|
^O Open with... n Create new/link
|
||||||
D File details ^R Rename entry
|
D File details ^R Rename entry
|
||||||
⎵, ^K Copy entry path r Open dir in vidir
|
⎵, ^K Copy entry path r Open dir in vidir
|
||||||
Y, ^Y Toggle selection y List selection
|
^Y Toggle selection y List selection
|
||||||
|
Y Select all
|
||||||
P Copy selection X Delete selection
|
P Copy selection X Delete selection
|
||||||
V Move selection ^X Delete entry
|
V Move selection ^X Delete entry
|
||||||
f Archive entry F List archive
|
f Archive entry F List archive
|
||||||
|
|
2
nnn.1
2
nnn.1
|
@ -98,6 +98,8 @@ Rename selected entry
|
||||||
Open directory in vidir
|
Open directory in vidir
|
||||||
.It Ic Y, ^Y
|
.It Ic Y, ^Y
|
||||||
Toggle selection mode
|
Toggle selection mode
|
||||||
|
.It Ic Y
|
||||||
|
Select all entries in dir
|
||||||
.It Ic Space, ^K
|
.It Ic Space, ^K
|
||||||
Copy entry absolute path
|
Copy entry absolute path
|
||||||
.It Ic y
|
.It Ic y
|
||||||
|
|
35
src/nnn.c
35
src/nnn.c
|
@ -2286,7 +2286,8 @@ static bool show_help(char *path)
|
||||||
"b^O Open with... n Create new/link\n"
|
"b^O Open with... n Create new/link\n"
|
||||||
"cD File details ^R Rename entry\n"
|
"cD File details ^R Rename entry\n"
|
||||||
"8⎵, ^K Copy entry path r Open dir in vidir\n"
|
"8⎵, ^K Copy entry path r Open dir in vidir\n"
|
||||||
"8Y, ^Y Toggle selection y List selection\n"
|
"b^Y Toggle selection y List selection\n"
|
||||||
|
"cY Select all\n"
|
||||||
"cP Copy selection X Delete selection\n"
|
"cP Copy selection X Delete selection\n"
|
||||||
"cV Move selection ^X Delete entry\n"
|
"cV Move selection ^X Delete entry\n"
|
||||||
"cf Archive entry F List archive\n"
|
"cf Archive entry F List archive\n"
|
||||||
|
@ -2743,7 +2744,7 @@ static void redraw(char *path)
|
||||||
get_file_sym(dents[cur].mode));
|
get_file_sym(dents[cur].mode));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
printmsg("0 items");
|
printmsg("0/0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode_changed) {
|
if (mode_changed) {
|
||||||
|
@ -3360,11 +3361,23 @@ nochange:
|
||||||
printmsg("selection on");
|
printmsg("selection on");
|
||||||
DPRINTF_S("selection on");
|
DPRINTF_S("selection on");
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
} // fallthrough
|
||||||
|
case SEL_COPYALL:
|
||||||
|
if (sel == SEL_COPYALL) {
|
||||||
|
if (!ndents) {
|
||||||
|
printmsg("0 entries");
|
||||||
|
goto nochange;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg.copymode = 0;
|
||||||
|
copybufpos = 0;
|
||||||
|
ncp = 0;
|
||||||
|
copystartid = 0;
|
||||||
|
copyendid = ndents - 1;
|
||||||
|
}
|
||||||
if (!ncp) { /* Handle range selection */
|
if (!ncp) { /* Handle range selection */
|
||||||
#ifndef DIR_LIMITED_COPY
|
#ifndef DIR_LIMITED_COPY
|
||||||
if (g_crc != crc8fast((uchar *)dents,
|
if ((sel != SEL_COPYALL) && g_crc != crc8fast((uchar *)dents,
|
||||||
ndents * sizeof(struct entry))) {
|
ndents * sizeof(struct entry))) {
|
||||||
cfg.copymode = 0;
|
cfg.copymode = 0;
|
||||||
printmsg("range error: dir/content changed");
|
printmsg("range error: dir/content changed");
|
||||||
|
@ -3372,13 +3385,15 @@ nochange:
|
||||||
goto nochange;
|
goto nochange;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (cur < copystartid) {
|
if (sel != SEL_COPYALL) {
|
||||||
copyendid = copystartid;
|
if (cur < copystartid) {
|
||||||
copystartid = cur;
|
copyendid = copystartid;
|
||||||
} else
|
copystartid = cur;
|
||||||
copyendid = cur;
|
} else
|
||||||
|
copyendid = cur;
|
||||||
|
}
|
||||||
|
|
||||||
if (copystartid < copyendid) {
|
if (copystartid < copyendid || sel == SEL_COPYALL) {
|
||||||
for (r = copystartid; r <= copyendid; ++r)
|
for (r = copystartid; r <= copyendid; ++r)
|
||||||
if (!appendfpath(newpath, mkpath(path,
|
if (!appendfpath(newpath, mkpath(path,
|
||||||
dents[r].name, newpath)))
|
dents[r].name, newpath)))
|
||||||
|
|
|
@ -73,6 +73,7 @@ enum action {
|
||||||
SEL_REDRAW,
|
SEL_REDRAW,
|
||||||
SEL_COPY,
|
SEL_COPY,
|
||||||
SEL_COPYMUL,
|
SEL_COPYMUL,
|
||||||
|
SEL_COPYALL,
|
||||||
SEL_COPYLIST,
|
SEL_COPYLIST,
|
||||||
SEL_CP,
|
SEL_CP,
|
||||||
SEL_MV,
|
SEL_MV,
|
||||||
|
@ -189,7 +190,8 @@ static struct key bindings[] = {
|
||||||
{ ' ', SEL_COPY },
|
{ ' ', SEL_COPY },
|
||||||
/* Toggle copy multiple file paths */
|
/* Toggle copy multiple file paths */
|
||||||
{ CONTROL('Y'), SEL_COPYMUL },
|
{ CONTROL('Y'), SEL_COPYMUL },
|
||||||
{ 'Y', SEL_COPYMUL },
|
/* Select all files in current dir */
|
||||||
|
{ 'Y', SEL_COPYALL },
|
||||||
/* Show list of copied files */
|
/* Show list of copied files */
|
||||||
{ 'y', SEL_COPYLIST },
|
{ 'y', SEL_COPYLIST },
|
||||||
/* Copy from copy buffer */
|
/* Copy from copy buffer */
|
||||||
|
|
Loading…
Add table
Reference in a new issue