]> Sergey Matveev's repositories - nnn.git/commitdiff
Shortcut to visit root
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 12 Apr 2019 14:51:48 +0000 (20:21 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 12 Apr 2019 15:06:23 +0000 (20:36 +0530)
README.md
src/nnn.c
src/nnn.h

index cad81c64c8debdd30b73824eb2c488923d77cc85..9e92db28a6b347561e90787be03041f0de02d91c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -237,7 +237,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
  NAVIGATION
           ↑ k  Up          PgUp ^U  Scroll up
           ↓ j  Down        PgDn ^D  Scroll down
-          ← h  Parent dir        ~  Go HOME
+          ← h  Parent dir      ~ `  HOME, /
         ↵ → l  Open file/dir     @  Start dir
     Home g ^A  First entry       -  Last visited dir
      End G ^E  Last entry        .  Toggle show hidden
@@ -280,6 +280,7 @@ The Leader key provides a powerful multi-functional navigation mechanism. It is
 | <kbd><</kbd>, <kbd>,</kbd> | Go to previous active context |
 | key | Go to bookmarked location |
 | <kbd>~</kbd> | Go to HOME directory |
+| <kbd>`</kbd> | Go to `/` |
 | <kbd>-</kbd> | Go to last visited directory |
 | <kbd>@</kbd> | Go to start directory |
 | <kbd>q</kbd> | Quit context |
index 67ebdf1a201c913b2d33342d7e3211d384bcf2a3..6289a080a4befa85f09aca82e632a2f6bfa2c79b 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -2360,7 +2360,7 @@ static bool show_help(const char *path)
                "1NAVIGATION\n"
                "a↑ k  Up          PgUp ^U  Scroll up\n"
                "a↓ j  Down        PgDn ^D  Scroll down\n"
-               "a← h  Parent dir        ~  Go HOME\n"
+               "a← h  Parent dir      ~ `  HOME, /\n"
              "8↵ → l  Open file/dir     @  Start dir\n"
          "4Home g ^A  First entry       -  Last visited dir\n"
           "5End G ^E  Last entry        .  Toggle show hidden\n"
@@ -3077,6 +3077,7 @@ nochange:
                case SEL_CDHOME: // fallthrough
                case SEL_CDBEGIN: // fallthrough
                case SEL_CDLAST: // fallthrough
+               case SEL_CDROOT: // fallthrough
                case SEL_VISIT:
                        switch (sel) {
                        case SEL_CDHOME:
@@ -3088,6 +3089,9 @@ nochange:
                        case SEL_CDLAST:
                                dir = lastdir;
                                break;
+                       case SEL_CDROOT:
+                               dir = "/";
+                               break;
                        default: /* case SEL_VISIT */
                                dir = mark;
                                break;
@@ -3131,6 +3135,7 @@ nochange:
                        switch (fd) {
                        case 'q': // fallthrough
                        case '~': // fallthrough
+                       case '`': // fallthrough
                        case '-': // fallthrough
                        case '@':
                                presel = fd;
index 2104ede797aa2b173bd6246e4b8ef9466e9ba2cd..839ec0c17422df81ee5db90d9d04ca9c0d4ca456 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -48,6 +48,7 @@ enum action {
        SEL_CDHOME,
        SEL_CDBEGIN,
        SEL_CDLAST,
+       SEL_CDROOT,
        SEL_VISIT,
        SEL_LEADER,
        SEL_CYCLE,
@@ -141,6 +142,8 @@ static struct key bindings[] = {
        { '@',            SEL_CDBEGIN },
        /* Last visited dir */
        { '-',            SEL_CDLAST },
+       /* Go to / */
+       { '`',            SEL_CDROOT },
        /* Visit marked directory */
        { CONTROL('B'),   SEL_VISIT },
        /* Leader key */