]> Sergey Matveev's repositories - nnn.git/commitdiff
Remap ^S and ^Q.
authorArun Prakash Jana <engineerarun@gmail.com>
Tue, 9 Jan 2018 08:51:09 +0000 (14:21 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Tue, 9 Jan 2018 08:51:09 +0000 (14:21 +0530)
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.

README.md
nnn.1
nnn.c
nnn.h

index 04bc8594ffca1789eb4ccdd49b6ede28a9d564f3..77aba329b5cdd5ef9f39ae5f8da1397352e1b190 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/nnn.1 b/nnn.1
index 1cc7dcb9eb0718724f9ad0bafeb1c596c00872ef..1bdde5640e770de274cfe517be5e948b88afcf27 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -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
diff --git a/nnn.c b/nnn.c
index 33060f87e5b7b85f7fbfbfe139e5cdf45975d300..96358fff1a0e5214a7c1eb821ec4bcdc490e4490 100644 (file)
--- a/nnn.c
+++ b/nnn.c
@@ -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;
diff --git a/nnn.h b/nnn.h
index 37cfbed6443b2c31fba5b721a55584a104fcfdb4..06782bf404fe41655679851bf20207df021f25b0 100644 (file)
--- a/nnn.h
+++ b/nnn.h
@@ -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,      "",     "" },
 };