remove program option -f

This commit is contained in:
Arun Prakash Jana 2019-12-14 20:24:42 +05:30
parent 5b0b63e7d6
commit 95f530854d
No known key found for this signature in database
GPG key ID: A75979F35C080412
5 changed files with 7 additions and 40 deletions

View file

@ -18,7 +18,6 @@ _nnn ()
-d
-e
-E
-f
-g
-H
-i

View file

@ -17,7 +17,6 @@ complete -c nnn -s c -d 'cli-only opener'
complete -c nnn -s d -d 'start in detail mode'
complete -c nnn -s e -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)'
complete -c nnn -s E -d 'use EDITOR for undetached edits'
complete -c nnn -s f -d 'run filter as cmd on prompt key'
complete -c nnn -s g -d 'regex filters'
complete -c nnn -s H -d 'show hidden files'
complete -c nnn -s i -d 'start in navigate-as-you-type mode'

View file

@ -15,7 +15,6 @@ args=(
'(-d)-d[start in detail mode]'
'(-e)-e[load session]:session name'
'(-E)-E[use EDITOR for undetached edits]'
'(-f)-f[run filter as cmd on prompt key]'
'(-g)-g[regex filters]'
'(-H)-H[show hidden files]'
'(-i)-i[start in navigate-as-you-type mode]'

8
nnn.1
View file

@ -12,7 +12,6 @@
.Op Ar -d
.Op Ar -e name
.Op Ar -E
.Op Ar -f
.Op Ar -g
.Op Ar -H
.Op Ar -i
@ -62,9 +61,6 @@ supports the following options:
.Fl E
use $EDITOR for internal undetached edits
.Pp
.Fl f
run filter as command when the prompt key is pressed
.Pp
.Fl g
use regex filters instead of substring match
.Pp
@ -148,14 +144,12 @@ with a '^' (caret) symbol.
.br
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
.Pp
There is a program option to execute the current filter as a command when the prompt key is pressed.
.Pp
In the \fInavigate-as-you-type\fR mode directories are opened in filter mode,
allowing continuous navigation. Works best with the \fBarrow keys\fR.
.br
When there's a unique match and it's a directory,
.Nm
auto selects the directory and enters it in this mode.
auto selects the directory and enters it in this mode. Use the relevant program option to disable this behaviour.
.Sh SELECTION
There are 3 groups of keybinds to add files to selection:
.Pp

View file

@ -227,9 +227,8 @@ typedef struct {
uint selmode : 1; /* Set when selecting files */
uint showdetail : 1; /* Clear to show fewer file info */
uint ctxactive : 1; /* Context active or not */
uint reserved : 2;
uint reserved : 3;
/* The following settings are global */
uint x11 : 1; /* Copy to system clipboard and show notis */
uint curctx : 2; /* Current context number */
uint dircolor : 1; /* Current status of dir color */
uint picker : 1; /* Write selection to user-specified file */
@ -241,7 +240,7 @@ typedef struct {
uint runplugin : 1; /* Choose plugin mode */
uint runctx : 2; /* The context in which plugin is to be run */
uint filter_re : 1; /* Use regex filters */
uint filtercmd : 1; /* Run filter as command on no match */
uint x11 : 1; /* Copy to system clipboard and show notis */
uint trash : 1; /* Move removed files to trash */
uint mtime : 1; /* Use modification time (else access time) */
uint cliopener : 1; /* All-CLI app opener */
@ -282,7 +281,6 @@ static settings cfg = {
0, /* showdetail */
1, /* ctxactive */
0, /* reserved */
0, /* x11 */
0, /* curctx */
0, /* dircolor */
0, /* picker */
@ -294,7 +292,7 @@ static settings cfg = {
0, /* runplugin */
0, /* runctx */
0, /* filter_re */
0, /* filtercmd */
0, /* x11 */
0, /* trash */
1, /* mtime */
0, /* cliopener */
@ -2058,28 +2056,10 @@ static int filterentries(char *path)
if (r == OK) {
/* Handle all control chars in main loop */
if ((*ch < ASCII_MAX && keyname(*ch)[0] == '^' && *ch != '^')
|| (*ch == ']' && len == 1)) {
if (*ch < ASCII_MAX && keyname(*ch)[0] == '^' && *ch != '^') {
DPRINTF_D(*ch);
DPRINTF_S(keyname(*ch));
/* If there's a filter, try a command on ^P */
if (cfg.filtercmd && *ch == CONTROL('P') && len > 1) {
prompt_run(pln, (ndents ? dents[cur].name : ""), path);
/* Clear the prompt */
while (len > 1)
wln[--len] = '\0';
wcstombs(ln, wln, REGEX_MAX);
ndents = total;
cur = oldcur = 0; /* Ran a command, refresh */
if (matches(pln) != -1)
redraw(path);
printprompt(ln);
continue;
}
if (len == 1)
cur = oldcur;
goto end;
@ -3497,7 +3477,7 @@ static void show_help(const char *path)
"cC Execute file i ^V Pick plugin\n"
"cs Manage session = Launch app\n"
"cc Connect remote u Unmount\n"
"9] ^P Prompt/run cmd L Lock\n"};
"9] ^P Prompt L Lock\n"};
fd = create_tmp_file();
if (fd == -1)
@ -5443,7 +5423,6 @@ static void usage(void)
" -d detail mode\n"
" -e name load session by name\n"
" -E use EDITOR for undetached edits\n"
" -f run filter as cmd on prompt key\n"
" -g regex filters [default: string]\n"
" -H show hidden files\n"
" -i nav-as-you-type mode\n"
@ -5599,7 +5578,7 @@ int main(int argc, char *argv[])
bool progress = FALSE;
#endif
while ((opt = getopt(argc, argv, "HSKiab:cde:Efgnop:rRtvxh")) != -1) {
while ((opt = getopt(argc, argv, "HSKiab:cde:Egnop:rRtvxh")) != -1) {
switch (opt) {
case 'S':
cfg.blkorder = 1;
@ -5627,9 +5606,6 @@ int main(int argc, char *argv[])
case 'E':
cfg.waitedit = 1;
break;
case 'f':
cfg.filtercmd = 1;
break;
case 'g':
cfg.filter_re = 1;
filterfn = &visible_re;