Remap ^S and ^Q.

The replacement keys are:

^J - toggle du mode
^Y - quit

The change is done because ^S, ^Q keybinds are lost in the following case:
- start nnn
- navigate to a different directory
- spawn a shell
- exit the shell

The issue happens only with the 'special' keybinds like ^S, ^Q, ^Z... which get
their original shell interpretation back.

So we are replacing these 2 keybinds with 2 'non-special' combinations.
This commit is contained in:
Arun Prakash Jana 2018-01-09 14:21:09 +05:30
parent 827f7fd662
commit 34b650aac8
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 10 additions and 10 deletions

View file

@ -237,7 +237,7 @@ optional arguments:
n | Create new
^R | Rename entry
s | Toggle sort by size
S, ^S | Toggle du mode
S, ^J | Toggle du mode
t | Toggle sort by mtime
! | Spawn SHELL in dir
e | Edit entry in EDITOR
@ -249,7 +249,7 @@ optional arguments:
^L | Redraw, clear prompt
? | Help, settings
Q | Quit and cd
q, ^Q | Quit
q, ^Y | Quit
```
Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens.

4
nnn.1
View file

@ -84,7 +84,7 @@ Create a new file or directory
Rename selected entry
.It Ic s
Toggle sort by file size
.It Ic S, ^S
.It Ic S, ^J
Toggle disk usage analyzer mode
.It Ic t
Toggle sort by time modified
@ -108,7 +108,7 @@ Force a redraw, clear rename or filter prompt
Toggle help and settings screen
.It Ic Q
Quit and change directory
.It Ic q, ^Q
.It Ic q, ^Y
Quit
.El
.Pp

8
nnn.c
View file

@ -988,9 +988,9 @@ filterentries(char *path)
case CONTROL('O'): // fallthrough
case CONTROL('B'): // fallthrough
case CONTROL('V'): // fallthrough
case CONTROL('S'): // fallthrough
case CONTROL('J'): // fallthrough
case CONTROL('X'): // fallthrough
case CONTROL('Q'):
case CONTROL('Y'):
goto end;
default:
/* Reset cur in case it's a repeat search */
@ -1717,7 +1717,7 @@ show_help(char *path)
"en | Create new\n"
"d^R | Rename entry\n"
"es | Toggle sort by size\n"
"aS, ^S | Toggle du mode\n"
"aS, ^J | Toggle du mode\n"
"et | Toggle sort by mtime\n"
"e! | Spawn SHELL in dir\n"
"ee | Edit entry in EDITOR\n"
@ -1729,7 +1729,7 @@ show_help(char *path)
"d^L | Redraw, clear prompt\n"
"e? | Help, settings\n"
"eQ | Quit and cd\n"
"aq, ^Q | Quit\n\n");
"aq, ^Y | Quit\n\n");
if (fd == -1)
return -1;

4
nnn.h
View file

@ -137,7 +137,7 @@ static struct key bindings[] = {
{ 's', SEL_FSIZE, "", "" },
/* Sort by total block count including dir contents */
{ 'S', SEL_BSIZE, "", "" },
{ CONTROL('S'), SEL_BSIZE, "", "" },
{ CONTROL('J'), SEL_BSIZE, "", "" },
/* Toggle sort by time */
{ 't', SEL_MTIME, "", "" },
/* Redraw window */
@ -163,5 +163,5 @@ static struct key bindings[] = {
{ 'Q', SEL_CDQUIT, "", "" },
/* Quit */
{ 'q', SEL_QUIT, "", "" },
{ CONTROL('Q'), SEL_QUIT, "", "" },
{ CONTROL('Y'), SEL_QUIT, "", "" },
};