@@ -37,6 +37,7 @@ _nnn () | |||||
-S | -S | ||||
-t | -t | ||||
-T | -T | ||||
-u | |||||
-V | -V | ||||
-x | -x | ||||
-h | -h | ||||
@@ -36,6 +36,7 @@ complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $ | |||||
complete -c nnn -s S -d 'persistent session' | complete -c nnn -s S -d 'persistent session' | ||||
complete -c nnn -s t -r -d 'timeout in seconds to lock' | complete -c nnn -s t -r -d 'timeout in seconds to lock' | ||||
complete -c nnn -s T -r -d 'a d e r s t v' | complete -c nnn -s T -r -d 'a d e r s t v' | ||||
complete -c nnn -s u -d 'use selection (no prompt)' | |||||
complete -c nnn -s V -d 'show program version and exit' | complete -c nnn -s V -d 'show program version and exit' | ||||
complete -c nnn -s x -d 'notis, sel to system clipboard' | complete -c nnn -s x -d 'notis, sel to system clipboard' | ||||
complete -c nnn -s h -d 'show program help' | complete -c nnn -s h -d 'show program help' |
@@ -34,6 +34,7 @@ args=( | |||||
'(-S)-S[persistent session]' | '(-S)-S[persistent session]' | ||||
'(-t)-t[timeout to lock]:seconds' | '(-t)-t[timeout to lock]:seconds' | ||||
'(-T)-T[a d e r s t v]:key' | '(-T)-T[a d e r s t v]:key' | ||||
'(-u)-u[use selection (no prompt)]' | |||||
'(-V)-V[show program version and exit]' | '(-V)-V[show program version and exit]' | ||||
'(-x)-x[notis, sel to system clipboard]' | '(-x)-x[notis, sel to system clipboard]' | ||||
'(-h)-h[show program help]' | '(-h)-h[show program help]' | ||||
@@ -30,6 +30,7 @@ | |||||
.Op Ar -S | .Op Ar -S | ||||
.Op Ar -t secs | .Op Ar -t secs | ||||
.Op Ar -T key | .Op Ar -T key | ||||
.Op Ar -u | |||||
.Op Ar -V | .Op Ar -V | ||||
.Op Ar -x | .Op Ar -x | ||||
.Op Ar -h | .Op Ar -h | ||||
@@ -134,6 +135,9 @@ supports the following options: | |||||
sort order | sort order | ||||
keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion | keys: 'a'u / 'd'u / 'e'xtension / 'r'everse / 's'ize / 't'ime / 'v'ersion | ||||
.Pp | .Pp | ||||
.Fl u | |||||
use selection if available, don't prompt to choose between selection and current entry | |||||
.Pp | |||||
.Fl V | .Fl V | ||||
show version and exit | show version and exit | ||||
.Pp | .Pp | ||||
@@ -275,6 +279,11 @@ from earlier writes. If you have 2 instances if | |||||
use the selection (e.g. to copy or move) in the other pane (if the instance | use the selection (e.g. to copy or move) in the other pane (if the instance | ||||
doesn't have any local selection already). | doesn't have any local selection already). | ||||
.Pp | .Pp | ||||
.Nm | |||||
clears the selection after successful file removal, batch-rename and link | |||||
creation with selection. However, it is retained after archive creation | |||||
with selection as the user may want to delete the archived files next. | |||||
.Pp | |||||
To edit the selection use the _edit selection_ key. Use this key to remove a | To edit the selection use the _edit selection_ key. Use this key to remove a | ||||
file from selection after you navigate away from its directory. Editing doesn't | file from selection after you navigate away from its directory. Editing doesn't | ||||
end the selection mode. You can add more files to the selection and edit the | end the selection mode. You can add more files to the selection and edit the | ||||
@@ -263,7 +263,8 @@ typedef struct { | |||||
uint reserved1 : 1; | uint reserved1 : 1; | ||||
/* The following settings are global */ | /* The following settings are global */ | ||||
uint curctx : 3; /* Current context number */ | uint curctx : 3; /* Current context number */ | ||||
uint reserved2 : 2; | |||||
uint prefersel : 1; /* Prefer selection over current, if exists */ | |||||
uint reserved2 : 1; | |||||
uint nonavopen : 1; /* Open file on right arrow or `l` */ | uint nonavopen : 1; /* Open file on right arrow or `l` */ | ||||
uint autoselect : 1; /* Auto-select dir in type-to-nav mode */ | uint autoselect : 1; /* Auto-select dir in type-to-nav mode */ | ||||
uint cursormode : 1; /* Move hardware cursor with selection */ | uint cursormode : 1; /* Move hardware cursor with selection */ | ||||
@@ -334,6 +335,7 @@ static settings cfg = { | |||||
0, /* version */ | 0, /* version */ | ||||
0, /* reserved1 */ | 0, /* reserved1 */ | ||||
0, /* curctx */ | 0, /* curctx */ | ||||
0, /* prefersel */ | |||||
0, /* reserved2 */ | 0, /* reserved2 */ | ||||
0, /* nonavopen */ | 0, /* nonavopen */ | ||||
1, /* autoselect */ | 1, /* autoselect */ | ||||
@@ -864,6 +866,9 @@ static int get_input(const char *prompt) | |||||
static int get_cur_or_sel(void) | static int get_cur_or_sel(void) | ||||
{ | { | ||||
if (selbufpos && ndents) { | if (selbufpos && ndents) { | ||||
if (cfg.prefersel) | |||||
return 's'; | |||||
int choice = get_input(messages[MSG_CUR_SEL_OPTS]); | int choice = get_input(messages[MSG_CUR_SEL_OPTS]); | ||||
return ((choice == 'c' || choice == 's') ? choice : 0); | return ((choice == 'c' || choice == 's') ? choice : 0); | ||||
@@ -6851,6 +6856,7 @@ static void usage(void) | |||||
" -S persistent session\n" | " -S persistent session\n" | ||||
" -t secs timeout to lock\n" | " -t secs timeout to lock\n" | ||||
" -T key sort order [a/d/e/r/s/t/v]\n" | " -T key sort order [a/d/e/r/s/t/v]\n" | ||||
" -u use selection (no prompt)\n" | |||||
" -V show version\n" | " -V show version\n" | ||||
" -x notis, sel to system clipboard\n" | " -x notis, sel to system clipboard\n" | ||||
" -h show help\n\n" | " -h show help\n\n" | ||||
@@ -7000,7 +7006,7 @@ int main(int argc, char *argv[]) | |||||
while ((opt = (env_opts_id > 0 | while ((opt = (env_opts_id > 0 | ||||
? env_opts[--env_opts_id] | ? env_opts[--env_opts_id] | ||||
: getopt(argc, argv, "aAb:cCdeEfFgHKl:nop:P:QrRs:St:T:Vxh"))) != -1) { | |||||
: getopt(argc, argv, "aAb:cCdeEfFgHKl:nop:P:QrRs:St:T:uVxh"))) != -1) { | |||||
switch (opt) { | switch (opt) { | ||||
#ifndef NOFIFO | #ifndef NOFIFO | ||||
case 'a': | case 'a': | ||||
@@ -7108,6 +7114,9 @@ int main(int argc, char *argv[]) | |||||
if (env_opts_id < 0) | if (env_opts_id < 0) | ||||
sort = (uchar)optarg[0]; | sort = (uchar)optarg[0]; | ||||
break; | break; | ||||
case 'u': | |||||
cfg.prefersel = 1; | |||||
break; | |||||
case 'V': | case 'V': | ||||
fprintf(stdout, "%s\n", VERSION); | fprintf(stdout, "%s\n", VERSION); | ||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||