Introduce key prompt

This commit is contained in:
Arun Prakash Jana 2018-11-09 04:27:42 +05:30
parent 70f561dd71
commit e8eeff9b3d
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 22 additions and 12 deletions

View file

@ -49,6 +49,7 @@ Have fun with it! Missing a feature? Want to contribute? Head to the rolling [To
- [Usage](#usage) - [Usage](#usage)
- [Cmdline options](#cmdline-options) - [Cmdline options](#cmdline-options)
- [Keyboard shortcuts](#keyboard-shortcuts) - [Keyboard shortcuts](#keyboard-shortcuts)
- [Key prompt](#key-prompt)
- [Contexts](#contexts) - [Contexts](#contexts)
- [Filters](#filters) - [Filters](#filters)
- [Navigate-as-you-type mode](#navigate-as-you-type-mode) - [Navigate-as-you-type mode](#navigate-as-you-type-mode)
@ -223,7 +224,7 @@ optional args:
- Last visited dir - Last visited dir
/ Filter entries / Filter entries
. Toggle show hidden . Toggle show hidden
^B Bookmark prompt ^B Key prompt
b Pin current dir b Pin current dir
^V Go to pinned dir ^V Go to pinned dir
d Toggle detail view d Toggle detail view
@ -259,6 +260,22 @@ optional args:
Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens. Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens.
#### Key prompt
The key prompt, invoked by <kbd>^B</kbd>, provides a powerful multi-functional navigation mechanism. It understands contexts, bookmarks and handy location shortcuts.
| Key | Function |
|:---:| --- |
| <kbd>1-4</kbd> | Go to selected context |
| <kbd>></kbd>, <kbd>.</kbd> | Go to next active context |
| <kbd><</kbd>, <kbd>,</kbd> | Go to previous active context |
| key | Go to bookmarked location |
| <kbd>~</kbd> | Go to HOME directory |
| <kbd>-</kbd> | Go to last visited directory |
| <kbd>&</kbd> | Go to start directory |
If all the configured bookmark keys are single character, the prompt is not shown and <kbd>Enter</kbd> is not required; just press <kbd>^B</kbd> followed by the key.
#### Contexts #### Contexts
Contexts (aka _tabs_ aka _workspaces_) serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner: Contexts (aka _tabs_ aka _workspaces_) serve the purpose of exploring multiple directories simultaneously. 4 contexts are available. The status of the contexts are shown in the top left corner:
@ -267,8 +284,6 @@ Contexts (aka _tabs_ aka _workspaces_) serve the purpose of exploring multiple d
- other used contexts are underlined - other used contexts are underlined
- rest are unused - rest are unused
The bookmark prompt understands contexts. To switch contexts press <kbd>^B</kbd> and enter the context number (1-4). <kbd>>/.</kbd> and <kbd></.</kbd> at the bookmark prompt cycles between active contexts.
The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory. The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory.
When a context is quit, the next active context is selected. If the last active context is quit, the program quits. When a context is quit, the next active context is selected. If the last active context is quit, the program quits.
@ -356,10 +371,6 @@ Set environment variable `NNN_BMS` as a string of `key:location` pairs (max 10)
export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/' export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
The bookmark prompt also understands the <kbd>~</kbd> (HOME), <kbd>-</kbd> (last visited directory) and <kbd>&</kbd> (start directory) shortcuts.
If all the configured bookmark keys are single character, the prompt is disabled and <kbd>Enter</kbd> is not required; just press <kbd>^B</kbd> followed by the key.
#### copy file paths #### copy file paths
##### selection shortcuts ##### selection shortcuts

7
nnn.1
View file

@ -18,7 +18,7 @@
.Op Ar PATH .Op Ar PATH
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
(Noice is Not Noice) is a performance-optimized, feature-packed fork of noice (http://git.2f30.org/noice/) with seamless desktop integration, simplified navigation, \fInavigate-as-you-type\fR mode, bookmarks, disk usage analyzer mode, comprehensive file details and much more. It remains a simple and efficient file manager that stays out of your way. (Noice is Not Noice) is a performance-optimized, feature-packed fork of noice (http://git.2f30.org/noice/) with seamless desktop integration, simplified navigation, \fInavigate-as-you-type\fR mode, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more. It remains a simple and efficient file manager that stays out of your way.
.Pp .Pp
.Nm .Nm
opens the current working directory by default if opens the current working directory by default if
@ -60,7 +60,7 @@ Change filter (more information below)
.It Ic \&. .It Ic \&.
Toggle show hidden . (dot) files Toggle show hidden . (dot) files
.It Ic ^B .It Ic ^B
Show bookmark key prompt (understands ~, -, &) Show key prompt (recognizes bookmark keys, ~, -, & and context IDs)
.It Ic b .It Ic b
Pin current directory Pin current directory
.It Ic ^V .It Ic ^V
@ -192,7 +192,7 @@ simultaneously. 4 contexts are available. The status of the contexts are shown i
.br .br
- rest are unused - rest are unused
.Pp .Pp
The bookmark prompt understands contexts. To switch contexts press \fI^B\fR and enter the context number (1-4). The key prompt understands contexts. To switch contexts press \fI^B\fR and enter the context number (1-4).
.Pp .Pp
The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory. The first time a context is entered, it copies the state of the last visited context. Each context remembers its start directory and last visited directory.
.Pp .Pp
@ -247,7 +247,6 @@ when dealing with the !, e and p commands respectively.
.Bd -literal .Bd -literal
export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/' export NNN_BMS='doc:~/Documents;u:/home/user/Cam Uploads;D:~/Downloads/'
.Ed .Ed
The bookmark prompt also understands the \fI~\fR (HOME), \fI-\fR (last visited directory) and \fI&\fR shortcuts.
.Pp .Pp
\fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text \fBNNN_USE_EDITOR:\fR use EDITOR (preferably CLI, fallback vi) to handle text
files. files.

2
nnn.c
View file

@ -1971,7 +1971,7 @@ static int show_help(char *path)
"e- Last visited dir\n" "e- Last visited dir\n"
"e/ Filter entries\n" "e/ Filter entries\n"
"e. Toggle show hidden\n" "e. Toggle show hidden\n"
"d^B Bookmark prompt\n" "d^B Key prompt\n"
"eb Pin current dir\n" "eb Pin current dir\n"
"d^V Go to pinned dir\n" "d^V Go to pinned dir\n"
"ed Toggle detail view\n" "ed Toggle detail view\n"