README.md | 4 ++-- config.def.h | 1 + nnn.1 | 4 ++-- nnn.c | 17 +++++++++-------- diff --git a/README.md b/README.md index ae36f60787b14ce63201b8eca6f04e724725cd2a..0edf3c67b5fab9f8f524d5adb464b469df758c66 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ e | Edit entry in EDITOR (fallback vi) o | Open dir in NNN_DE_FILE_MANAGER p | Open entry in PAGER (fallback less) ^K | Invoke file path copier - ^L | Force a redraw, exit filter prompt + ^L, F2 | Force a redraw, exit filter prompt ? | Toggle help and settings screen Q | Quit and change directory q, ^Q | Quit @@ -191,7 +191,7 @@ #### Filters Filters support regexes to instantly (search-as-you-type) list the matching entries in the current directory. -There are 3 ways to reset a filter: ^L, a search with no matches or an extra backspace at the filter prompt (like vi). +There are 3 ways to reset a filter: ^L (or F2), a search with no matches or an extra backspace at the filter prompt (like vi). Common examples: If you want to list all matches starting with the filter expression, start the expression with a `^` (caret) symbol. Type `\.mkv` to list all MKV files. diff --git a/config.def.h b/config.def.h index 724adbb03eab9829c508dcd1415b34a1eb99bc95..af53cc94b513b344164406a6e04e11749b1cfbb8 100644 --- a/config.def.h +++ b/config.def.h @@ -133,6 +133,7 @@ { 'S', SEL_BSIZE, "", "" }, /* Toggle sort by time */ { 't', SEL_MTIME, "", "" }, { CONTROL('L'), SEL_REDRAW, "", "" }, + { KEY_F(2), SEL_REDRAW, "", "" }, /* Copy currently selected file path */ { CONTROL('K'), SEL_COPY, "", "" }, /* Show help */ diff --git a/nnn.1 b/nnn.1 index 303d630205e50f805f0ee4997aac811007b85392..bbd2a445d5b9168776861085803e0a3c449b4ca2 100644 --- a/nnn.1 +++ b/nnn.1 @@ -85,7 +85,7 @@ .It Ic p Open current entry in PAGER (fallback less) .It Ic ^K Invoke file path copier -.It Ic ^L +.It Ic ^L, [F2] Force a redraw, exit filter prompt .It Ic \&? Toggle help and settings screen @@ -141,7 +141,7 @@ .Sh FILTERS Filters support regexes to instantly (search-as-you-type) list the matching entries in the current directory. .Pp -There are 3 ways to reset a filter: \fI^L\fR, a search with no +There are 3 ways to reset a filter: \fI^L\fR (or \fIF2\fR), a search with no matches or an extra backspace at the filter prompt (like vi). .Pp Common examples: If you want to list all matches starting with the filter diff --git a/nnn.c b/nnn.c index fb178a035b30a797920cfc731e79ac765089b036..64e7daff5b3673f70549e3ff10426eb6cc1fecfb 100644 --- a/nnn.c +++ b/nnn.c @@ -59,7 +59,8 @@ va_end(ap); return r; } -static int enabledbg() +static int +enabledbg() { FILE *fp = fopen("/tmp/nnn_debug", "w"); @@ -77,7 +78,8 @@ return 0; } -static void disabledbg() +static void +disabledbg() { close(DEBUG_FD); } @@ -832,7 +834,8 @@ break; case KEY_DOWN: // fallthrough case KEY_UP: // fallthrough case KEY_LEFT: // fallthrough - case KEY_RIGHT: + case KEY_RIGHT: // fallthrough + case KEY_F(2): if (len == 1) cur = oldcur; // fallthrough default: @@ -1379,7 +1382,7 @@ e | Edit entry in EDITOR (fallback vi)\n\ o | Open dir in NNN_DE_FILE_MANAGER\n\ p | Open entry in PAGER (fallback less)\n\ ^K | Invoke file path copier\n\ - ^L | Force a redraw, exit filter prompt\n\ + ^L, F2 | Force a redraw, exit filter prompt\n\ ? | Toggle help and settings screen\n\ Q | Quit and change directory\n\ q, ^Q | Quit\n\n\n"); @@ -2450,13 +2453,11 @@ fprintf(stderr, "%s: %s\n", ipath, strerror(errno)); exit(1); } + /* Set locale */ + setlocale(LC_ALL, ""); #ifdef DEBUGMODE enabledbg(); #endif - - /* Set locale */ - setlocale(LC_ALL, ""); - initcurses(); browse(ipath, ifilter); exitcurses();