Insert key for navigate-as-you-type mode

This commit is contained in:
Arun Prakash Jana 2017-06-04 11:45:17 +05:30
parent 88e9df01a4
commit c42df81ae5
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 19 additions and 19 deletions

View file

@ -62,10 +62,10 @@ Have fun with it! PRs are welcome. Check out [#1](https://github.com/jarun/nnn/i
- Jump HOME or to the last visited directory (as usual!) - Jump HOME or to the last visited directory (as usual!)
- Jump to initial dir, chdir prompt, cd ..... (with . as PWD) - Jump to initial dir, chdir prompt, cd ..... (with . as PWD)
- Roll-over at edges, page through entries - Roll-over at edges, page through entries
- Navigate as you type with filters - *Navigate-as-you-type* with filters
- Disk usage analyzer mode - Disk usage analyzer mode
- Search - Search
- Filter directory contents with search-as-you-type - Filter directory contents with *search-as-you-type*
- Desktop search (default gnome-search-tool, customizable) integration - Desktop search (default gnome-search-tool, customizable) integration
- Mimes - Mimes
- Desktop opener integration - Desktop opener integration
@ -134,7 +134,7 @@ nnn needs libreadline, libncursesw (on Linux or ncurses on OS X) and standard li
optional arguments: optional arguments:
-d start in detail view mode -d start in detail view mode
-f start in navigate-as-you-type mode -i start in navigate-as-you-type mode
-p path to custom nlay -p path to custom nlay
-S start in disk usage analyzer mode -S start in disk usage analyzer mode
-v show program version and exit -v show program version and exit
@ -155,6 +155,7 @@ nnn needs libreadline, libncursesw (on Linux or ncurses on OS X) and standard li
End, G, $, ^E | Jump to last entry End, G, $, ^E | Jump to last entry
Right, Enter, l, ^M | Open file or enter dir Right, Enter, l, ^M | Open file or enter dir
Left, Bksp, h, ^H | Go to parent dir Left, Bksp, h, ^H | Go to parent dir
Insert | Toggle navigate-as-you-type mode
~ | Jump to HOME dir ~ | Jump to HOME dir
& | Jump to initial dir & | Jump to initial dir
- | Jump to last visited dir - | Jump to last visited dir
@ -164,7 +165,6 @@ Right, Enter, l, ^M | Open file or enter dir
c | Show change dir prompt c | Show change dir prompt
d | Toggle detail view d | Toggle detail view
D | Toggle current file details screen D | Toggle current file details screen
f | Toggle navigate-as-you-type mode
m | Show concise mediainfo m | Show concise mediainfo
M | Show full mediainfo M | Show full mediainfo
s | Toggle sort by file size s | Toggle sort by file size

View file

@ -37,7 +37,7 @@ static struct key bindings[] = {
/* Filter */ /* Filter */
{ '/', SEL_FLTR, "", "" }, { '/', SEL_FLTR, "", "" },
/* Toggle filter mode */ /* Toggle filter mode */
{ 'f', SEL_MFLTR, "", "" }, { KEY_IC, SEL_MFLTR, "", "" },
/* Desktop search */ /* Desktop search */
{ CONTROL('_'), SEL_SEARCH, "", "" }, { CONTROL('_'), SEL_SEARCH, "", "" },
/* Next */ /* Next */

18
nnn.1
View file

@ -7,8 +7,8 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm nnn .Nm nnn
.Op Ar -d .Op Ar -d
.Op Ar -f .Op Ar -i
.Op Ar -p .Op Ar -p custom_nlay
.Op Ar -S .Op Ar -S
.Op Ar -v .Op Ar -v
.Op Ar -h .Op Ar -h
@ -24,7 +24,7 @@ is not specified.
.Pp .Pp
.Nm .Nm
supports both vi-like and emacs-like key bindings in the default supports both vi-like and emacs-like key bindings in the default
configuration. The default key bindings are listed below. configuration. The default key bindings are listed below.
.Pp .Pp
.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact .Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact
.It Ic [Up], k, ^P .It Ic [Up], k, ^P
@ -43,6 +43,8 @@ Move to the last entry
Open file or enter directory Open file or enter directory
.It Ic [Left], [Backspace], h, ^H .It Ic [Left], [Backspace], h, ^H
Back up one directory level Back up one directory level
.It Ic [Insert]
Toggle navigate-as-you-type mode
.It Ic ~ .It Ic ~
Change to the HOME directory Change to the HOME directory
.It Ic & .It Ic &
@ -61,8 +63,6 @@ Change into the given directory
Toggle detail view Toggle detail view
.It Ic D .It Ic D
Toggle current file details screen Toggle current file details screen
.It Ic f
Toggle navigate-as-you-type mode
.It Ic m .It Ic m
Show concise mediainfo Show concise mediainfo
.It Ic M .It Ic M
@ -104,10 +104,10 @@ supports the following options:
.Fl d .Fl d
start in detail view mode start in detail view mode
.Pp .Pp
.Fl f .Fl i
start in navigate-as-you-type mode start in navigate-as-you-type mode
.Pp .Pp
.Fl p .Fl "p custom_nlay"
path to custom nlay path to custom nlay
.Pp .Pp
.Fl S .Fl S
@ -146,11 +146,11 @@ few easy steps. Please visit the project page (linked below) for the
instructions. instructions.
.Sh FILTERS .Sh FILTERS
Filters support regexes to display only the matched Filters support regexes to display only the matched
entries in the current directory view. This effectively allows entries in the current directory view. This effectively allows
searching through the directory tree for a particular entry. Matching entries searching through the directory tree for a particular entry. Matching entries
are shown instantly (search-as-you-type). are shown instantly (search-as-you-type).
.Pp .Pp
Filters do not stack on top of each other. They are applied anew Filters do not stack on top of each other. They are applied anew
every time. There are 4 ways to reset a filter: every time. There are 4 ways to reset a filter:
.Pp .Pp
The \fIInsert\fR key, an empty filter expression, a search with no results or an The \fIInsert\fR key, an empty filter expression, a search with no results or an

10
nnn.c
View file

@ -1248,6 +1248,7 @@ show_help(void)
End, G, $, ^E | Jump to last entry\n\ End, G, $, ^E | Jump to last entry\n\
Right, Enter, l, ^M | Open file or enter dir\n\ Right, Enter, l, ^M | Open file or enter dir\n\
Left, Bksp, h, ^H | Go to parent dir\n\ Left, Bksp, h, ^H | Go to parent dir\n\
Insert | Toggle navigate-as-you-type mode\n\
~ | Jump to HOME dir\n\ ~ | Jump to HOME dir\n\
& | Jump to initial dir\n\ & | Jump to initial dir\n\
- | Jump to last visited dir\n\ - | Jump to last visited dir\n\
@ -1257,7 +1258,6 @@ show_help(void)
c | Show change dir prompt\n\ c | Show change dir prompt\n\
d | Toggle detail view\n\ d | Toggle detail view\n\
D | Toggle current file details screen\n\ D | Toggle current file details screen\n\
f | Toggle navigate-as-you-type mode\n\
m | Show concise mediainfo\n\ m | Show concise mediainfo\n\
M | Show full mediainfo\n\ M | Show full mediainfo\n\
s | Toggle sort by file size\n\ s | Toggle sort by file size\n\
@ -2092,13 +2092,13 @@ nochange:
static void static void
usage(void) usage(void)
{ {
fprintf(stdout, "usage: nnn [-d] [-p custom_nlay] [-S] [-v] [-h] [PATH]\n\n\ fprintf(stdout, "usage: nnn [-d] [-i] [-p custom_nlay] [-S] [-v] [-h] [PATH]\n\n\
The missing terminal file browser for X.\n\n\ The missing terminal file browser for X.\n\n\
positional arguments:\n\ positional arguments:\n\
PATH directory to open [default: current dir]\n\n\ PATH directory to open [default: current dir]\n\n\
optional arguments:\n\ optional arguments:\n\
-d start in detail view mode\n\ -d start in detail view mode\n\
-f start in navigate-as-you-type mode\n\ -i start in navigate-as-you-type mode\n\
-p path to custom nlay\n\ -p path to custom nlay\n\
-S start in disk usage analyzer mode\n\ -S start in disk usage analyzer mode\n\
-v show program version and exit\n\ -v show program version and exit\n\
@ -2123,7 +2123,7 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
while ((opt = getopt(argc, argv, "dSfp:vh")) != -1) { while ((opt = getopt(argc, argv, "dSip:vh")) != -1) {
switch (opt) { switch (opt) {
case 'S': case 'S':
bsizeorder = 1; // fallthrough bsizeorder = 1; // fallthrough
@ -2132,7 +2132,7 @@ main(int argc, char *argv[])
showdetail = 1; showdetail = 1;
printptr = &printent_long; printptr = &printent_long;
break; break;
case 'f': case 'i':
filtermode = 1; filtermode = 1;
break; break;
case 'p': case 'p':