]> Sergey Matveev's repositories - nnn.git/commitdiff
Use ^B to go to next context
authorArun Prakash Jana <engineerarun@gmail.com>
Mon, 26 Nov 2018 21:49:37 +0000 (03:19 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Mon, 26 Nov 2018 22:31:51 +0000 (04:01 +0530)
README.md
nnn.1
src/nnn.c
src/nnn.h

index bd5a0790f74592fa42f7563072b3d1fb78ca9f49..c4142ca0241fb37204e2721c365d568fae4d7711 100644 (file)
--- a/README.md
+++ b/README.md
@@ -222,6 +222,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
     →, ↵, l, ^M  Open file/enter dir   .  Toggle show hidden
               /  Filter          Ins, ^I  Toggle nav-as-you-type
               b  Pin current dir      ^W  Go to pinned dir
+             ^B  Next active context
           `, ^/  Leader key      LeaderN  Switch to context N
             Esc  Exit prompt          ^L  Redraw, clear prompt
              ^G  Quit and cd           q  Quit context
diff --git a/nnn.1 b/nnn.1
index 736e1f41f1930b75d6eb6b352662b8d705d5654e..91fc2b99ac9190db81cea0c2a405382645de4e9b 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -64,6 +64,8 @@ Toggle navigate-as-you-type mode
 Pin current directory
 .It Ic ^W
 Visit pinned directory
+.It Ic ^B
+Next active context
 .It Ic `, ^/
 Leader key
 .It Ic LeaderN
index 522ba64c0c0b3b91c1cc7d35e96dd43a3d431863..f7cdbf045e19c9eed3c31bba1b6164a115910907 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1015,9 +1015,10 @@ static int nextsel(char **run, char **env, int *presel)
 
        c = *presel;
 
-       if (c == 0)
+       if (c == 0) {
                c = getch();
-       else {
+               DPRINTF_D(c);
+       } else {
                /* Unwatch dir if we are still in a filtered view */
 #ifdef LINUX_INOTIFY
                if (*presel == FILTER && inotify_wd >= 0) {
@@ -1978,7 +1979,8 @@ static int show_help(char *path)
    "4→, ↵, l, ^M  Open file/enter dir   .  Toggle show hidden\n"
              "e/  Filter          Ins, ^I  Toggle nav-as-you-type\n"
              "eb  Pin current dir      ^W  Go to pinned dir\n"
-         "a`, ^/  Leader key      LeaderN  Switch to context N\n"
+            "d^B  Next active context\n"
+         "a`, ^/  Leader key      LeaderN  Go to context N\n"
            "cEsc  Exit prompt          ^L  Redraw, clear prompt\n"
             "d^G  Quit and cd           q  Quit context\n"
          "aQ, ^Q  Quit                  ?  Help, config\n"
@@ -2729,7 +2731,11 @@ nochange:
                        setdirwatch();
                        goto begin;
                case SEL_LEADER:
-                       fd = get_input(NULL);
+                       fd = get_input(NULL); // fallthrough
+               case SEL_CYCLE:
+                       if (sel == SEL_CYCLE)
+                               fd = '>';
+
                        switch (fd) {
                        case 'q': // fallthrough
                        case '~': // fallthrough
index 4b13d91881537f3fdf8e0c9cbf111684f77c9ee6..0f82937dc7b6ed00c8fab6f8850cfdaeb3416e4a 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -49,6 +49,7 @@ enum action {
        SEL_CDBEGIN,
        SEL_CDLAST,
        SEL_LEADER,
+       SEL_CYCLE,
        SEL_PIN,
        SEL_VISIT,
        SEL_FLTR,
@@ -153,6 +154,8 @@ static struct key bindings[] = {
        /* Leader key */
        { CONTROL('_'),   SEL_LEADER,    "",     "" },
        { '`',            SEL_LEADER,    "",     "" },
+       /* Cycle contexts in forward direction */
+       { CONTROL('B'),   SEL_CYCLE,     "",     "" },
        /* Mark a path to visit later */
        { 'b',            SEL_PIN,       "",     "" },
        /* Visit marked directory */