Shortcut to visit root

This commit is contained in:
Arun Prakash Jana 2019-04-12 20:21:48 +05:30
parent 3e4797f728
commit 33365dea52
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 11 additions and 2 deletions

View file

@ -237,7 +237,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
NAVIGATION NAVIGATION
↑ k Up PgUp ^U Scroll up ↑ k Up PgUp ^U Scroll up
↓ j Down PgDn ^D Scroll down ↓ j Down PgDn ^D Scroll down
← h Parent dir ~ Go HOME ← h Parent dir ~ ` HOME, /
↵ → l Open file/dir @ Start dir ↵ → l Open file/dir @ Start dir
Home g ^A First entry - Last visited dir Home g ^A First entry - Last visited dir
End G ^E Last entry . Toggle show hidden 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 | | <kbd><</kbd>, <kbd>,</kbd> | Go to previous active context |
| key | Go to bookmarked location | | key | Go to bookmarked location |
| <kbd>~</kbd> | Go to HOME directory | | <kbd>~</kbd> | Go to HOME directory |
| <kbd>`</kbd> | Go to `/` |
| <kbd>-</kbd> | Go to last visited directory | | <kbd>-</kbd> | Go to last visited directory |
| <kbd>@</kbd> | Go to start directory | | <kbd>@</kbd> | Go to start directory |
| <kbd>q</kbd> | Quit context | | <kbd>q</kbd> | Quit context |

View file

@ -2360,7 +2360,7 @@ static bool show_help(const char *path)
"1NAVIGATION\n" "1NAVIGATION\n"
"a↑ k Up PgUp ^U Scroll up\n" "a↑ k Up PgUp ^U Scroll up\n"
"a↓ j Down PgDn ^D Scroll down\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" "8↵ → l Open file/dir @ Start dir\n"
"4Home g ^A First entry - Last visited dir\n" "4Home g ^A First entry - Last visited dir\n"
"5End G ^E Last entry . Toggle show hidden\n" "5End G ^E Last entry . Toggle show hidden\n"
@ -3077,6 +3077,7 @@ nochange:
case SEL_CDHOME: // fallthrough case SEL_CDHOME: // fallthrough
case SEL_CDBEGIN: // fallthrough case SEL_CDBEGIN: // fallthrough
case SEL_CDLAST: // fallthrough case SEL_CDLAST: // fallthrough
case SEL_CDROOT: // fallthrough
case SEL_VISIT: case SEL_VISIT:
switch (sel) { switch (sel) {
case SEL_CDHOME: case SEL_CDHOME:
@ -3088,6 +3089,9 @@ nochange:
case SEL_CDLAST: case SEL_CDLAST:
dir = lastdir; dir = lastdir;
break; break;
case SEL_CDROOT:
dir = "/";
break;
default: /* case SEL_VISIT */ default: /* case SEL_VISIT */
dir = mark; dir = mark;
break; break;
@ -3131,6 +3135,7 @@ nochange:
switch (fd) { switch (fd) {
case 'q': // fallthrough case 'q': // fallthrough
case '~': // fallthrough case '~': // fallthrough
case '`': // fallthrough
case '-': // fallthrough case '-': // fallthrough
case '@': case '@':
presel = fd; presel = fd;

View file

@ -48,6 +48,7 @@ enum action {
SEL_CDHOME, SEL_CDHOME,
SEL_CDBEGIN, SEL_CDBEGIN,
SEL_CDLAST, SEL_CDLAST,
SEL_CDROOT,
SEL_VISIT, SEL_VISIT,
SEL_LEADER, SEL_LEADER,
SEL_CYCLE, SEL_CYCLE,
@ -141,6 +142,8 @@ static struct key bindings[] = {
{ '@', SEL_CDBEGIN }, { '@', SEL_CDBEGIN },
/* Last visited dir */ /* Last visited dir */
{ '-', SEL_CDLAST }, { '-', SEL_CDLAST },
/* Go to / */
{ '`', SEL_CDROOT },
/* Visit marked directory */ /* Visit marked directory */
{ CONTROL('B'), SEL_VISIT }, { CONTROL('B'), SEL_VISIT },
/* Leader key */ /* Leader key */