@@ -46,7 +46,7 @@ Add to that an awesome [Wiki](https://github.com/jarun/nnn/wiki)! | |||||
- By file name, modification/access time, size, extension | - By file name, modification/access time, size, extension | ||||
- Search | - Search | ||||
- Instant filtering with *search-as-you-type* | - Instant filtering with *search-as-you-type* | ||||
- Regex (default) and substring match | |||||
- Regex and substring (default) matches | |||||
- Subtree search to open or edit files (using plugin) | - Subtree search to open or edit files (using plugin) | ||||
- Mimes | - Mimes | ||||
- Open with desktop opener or specify a custom app | - Open with desktop opener or specify a custom app | ||||
@@ -189,6 +189,7 @@ optional args: | |||||
-e name load session by name | -e name load session by name | ||||
-E use EDITOR for undetached edits | -E use EDITOR for undetached edits | ||||
-f run filter as cmd on prompt key | -f run filter as cmd on prompt key | ||||
-g regex filters [default: string] | |||||
-H show hidden files | -H show hidden files | ||||
-i nav-as-you-type mode | -i nav-as-you-type mode | ||||
-K detect key collision | -K detect key collision | ||||
@@ -197,7 +198,6 @@ optional args: | |||||
-p file selection file [stdout if '-'] | -p file selection file [stdout if '-'] | ||||
-r use advcpmv patched cp, mv | -r use advcpmv patched cp, mv | ||||
-R disable rollover at edges | -R disable rollover at edges | ||||
-s string filters [default: regex] | |||||
-S du mode | -S du mode | ||||
-t disable dir auto-select | -t disable dir auto-select | ||||
-v show version | -v show version | ||||
@@ -13,6 +13,7 @@ | |||||
.Op Ar -e name | .Op Ar -e name | ||||
.Op Ar -E | .Op Ar -E | ||||
.Op Ar -f | .Op Ar -f | ||||
.Op Ar -g | |||||
.Op Ar -H | .Op Ar -H | ||||
.Op Ar -i | .Op Ar -i | ||||
.Op Ar -K | .Op Ar -K | ||||
@@ -20,7 +21,6 @@ | |||||
.Op Ar -p file | .Op Ar -p file | ||||
.Op Ar -r | .Op Ar -r | ||||
.Op Ar -R | .Op Ar -R | ||||
.Op Ar -s | |||||
.Op Ar -S | .Op Ar -S | ||||
.Op Ar -v | .Op Ar -v | ||||
.Op Ar -x | .Op Ar -x | ||||
@@ -65,6 +65,9 @@ supports the following options: | |||||
.Fl f | .Fl f | ||||
run filter as command when the prompt key is pressed | run filter as command when the prompt key is pressed | ||||
.Pp | .Pp | ||||
.Fl g | |||||
use regex filters instead of substring match | |||||
.Pp | |||||
.Fl H | .Fl H | ||||
show hidden files | show hidden files | ||||
.Pp | .Pp | ||||
@@ -89,9 +92,6 @@ supports the following options: | |||||
.Fl R | .Fl R | ||||
disable rollover at edges | disable rollover at edges | ||||
.Pp | .Pp | ||||
.Fl s | |||||
use substring match for filters instead of regex | |||||
.Pp | |||||
.Fl S | .Fl S | ||||
start in disk usage analyzer mode | start in disk usage analyzer mode | ||||
.Pp | .Pp | ||||
@@ -137,10 +137,9 @@ When a session is loaded dynamically, the last working session is saved automati | |||||
All the session files are located in the \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR directory by the session name. | All the session files are located in the \fB${XDG_CONFIG_HOME:-$HOME/.config}/nnn/sessions\fR directory by the session name. | ||||
"@" is the "last session" file. | "@" is the "last session" file. | ||||
.Sh FILTERS | .Sh FILTERS | ||||
Filters support regexes (default) to instantly (search-as-you-type) list the matching | |||||
entries in the current directory. | |||||
Filters are substrings to find matching entries in the current directory instantly (search-as-you-type). There is a program option to use regex filters. | |||||
.Pp | .Pp | ||||
Common use cases: | |||||
Common regex use cases: | |||||
.Pp | .Pp | ||||
(1) To list all matches starting with the filter expression, start the expression | (1) To list all matches starting with the filter expression, start the expression | ||||
with a '^' (caret) symbol. | with a '^' (caret) symbol. | ||||
@@ -149,8 +148,6 @@ with a '^' (caret) symbol. | |||||
.br | .br | ||||
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search). | (3) Use '.*' to match any character (\fIsort of\fR fuzzy search). | ||||
.Pp | .Pp | ||||
There is a program option to filter entries by substring match instead of regex. | |||||
.Pp | |||||
There is a program option to execute the current filter as a command when the prompt key is pressed. | There is a program option to execute the current filter as a command when the prompt key is pressed. | ||||
.Pp | .Pp | ||||
In the \fInavigate-as-you-type\fR mode directories are opened in filter mode, | In the \fInavigate-as-you-type\fR mode directories are opened in filter mode, | ||||
@@ -293,7 +293,7 @@ static settings cfg = { | |||||
0, /* useeditor */ | 0, /* useeditor */ | ||||
0, /* runplugin */ | 0, /* runplugin */ | ||||
0, /* runctx */ | 0, /* runctx */ | ||||
1, /* filter_re */ | |||||
0, /* filter_re */ | |||||
0, /* filtercmd */ | 0, /* filtercmd */ | ||||
0, /* trash */ | 0, /* trash */ | ||||
1, /* mtime */ | 1, /* mtime */ | ||||
@@ -1804,7 +1804,7 @@ static int visible_str(const fltrexp_t *fltrexp, const char *fname) | |||||
return strcasestr(fname, fltrexp->str) != NULL; | return strcasestr(fname, fltrexp->str) != NULL; | ||||
} | } | ||||
static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_re; | |||||
static int (*filterfn)(const fltrexp_t *fltr, const char *fname) = &visible_str; | |||||
static int entrycmp(const void *va, const void *vb) | static int entrycmp(const void *va, const void *vb) | ||||
{ | { | ||||
@@ -5449,6 +5449,7 @@ static void usage(void) | |||||
" -e name load session by name\n" | " -e name load session by name\n" | ||||
" -E use EDITOR for undetached edits\n" | " -E use EDITOR for undetached edits\n" | ||||
" -f run filter as cmd on prompt key\n" | " -f run filter as cmd on prompt key\n" | ||||
" -g regex filters [default: string]\n" | |||||
" -H show hidden files\n" | " -H show hidden files\n" | ||||
" -i nav-as-you-type mode\n" | " -i nav-as-you-type mode\n" | ||||
" -K detect key collision\n" | " -K detect key collision\n" | ||||
@@ -5457,7 +5458,6 @@ static void usage(void) | |||||
" -p file selection file [stdout if '-']\n" | " -p file selection file [stdout if '-']\n" | ||||
" -r use advcpmv patched cp, mv\n" | " -r use advcpmv patched cp, mv\n" | ||||
" -R disable rollover at edges\n" | " -R disable rollover at edges\n" | ||||
" -s string filters [default: regex]\n" | |||||
" -S du mode\n" | " -S du mode\n" | ||||
" -t disable dir auto-select\n" | " -t disable dir auto-select\n" | ||||
" -v show version\n" | " -v show version\n" | ||||
@@ -5604,7 +5604,7 @@ int main(int argc, char *argv[]) | |||||
bool progress = FALSE; | bool progress = FALSE; | ||||
#endif | #endif | ||||
while ((opt = getopt(argc, argv, "HSKiab:cde:Efnop:rRstvxh")) != -1) { | |||||
while ((opt = getopt(argc, argv, "HSKiab:cde:Efgnop:rRtvxh")) != -1) { | |||||
switch (opt) { | switch (opt) { | ||||
case 'S': | case 'S': | ||||
cfg.blkorder = 1; | cfg.blkorder = 1; | ||||
@@ -5635,6 +5635,10 @@ int main(int argc, char *argv[]) | |||||
case 'f': | case 'f': | ||||
cfg.filtercmd = 1; | cfg.filtercmd = 1; | ||||
break; | break; | ||||
case 'g': | |||||
cfg.filter_re = 1; | |||||
filterfn = &visible_re; | |||||
break; | |||||
case 'H': | case 'H': | ||||
cfg.showhidden = 1; | cfg.showhidden = 1; | ||||
break; | break; | ||||
@@ -5669,10 +5673,6 @@ int main(int argc, char *argv[]) | |||||
case 'R': | case 'R': | ||||
cfg.rollover = 0; | cfg.rollover = 0; | ||||
break; | break; | ||||
case 's': | |||||
cfg.filter_re = 0; | |||||
filterfn = &visible_str; | |||||
break; | |||||
case 't': | case 't': | ||||
cfg.autoselect = 0; | cfg.autoselect = 0; | ||||
break; | break; | ||||