diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | src/nnn.c | 35 | ||||
-rw-r--r-- | src/nnn.h | 9 |
3 files changed, 34 insertions, 16 deletions
@@ -196,11 +196,11 @@ The list below is from the **dev branch**. Press <kbd>?</kbd> in `nnn` to see th ↵ → l Open file/dir . Toggle show hidden g ^A First entry G ^E Last entry b Pin current dir ^B Go to pinned dir - Tab ^I Next context d Toggle detail view + (Sh)Tab Cycle context d Toggle detail view , ^/ Lead key N LeadN Context N / Filter/Lead Ins ^T Toggle nav-as-you-type Esc Exit prompt ^L F5 Redraw/clear prompt - ? Help, config Lead' First file + ? Help, conf ' Lead' First file Q ^Q Quit ^G QuitCD q Quit context FILES ^O Open with... n Create new/link @@ -242,8 +242,6 @@ The Leader/Lead key provides a powerful multi-functional navigation mechanism. I | Key | Function | |:---:| --- | | <kbd>1-4</kbd> | Go to/create selected context | -| <kbd>]</kbd> | Go to next active context | -| <kbd>[</kbd> | Go to previous active context | | key | Go to bookmarked location | | <kbd>'</kbd> | Go to first file in directory | | <kbd>~</kbd> <kbd>`</kbd> <kbd>@</kbd> <kbd>-</kbd> | Visit HOME, `/`, start, last visited dir | @@ -2823,11 +2823,11 @@ static void show_help(const char *path) "8↵ → l Open file/dir . Toggle show hidden\n" "9g ^A First entry G ^E Last entry\n" "cb Pin current dir ^B Go to pinned dir\n" - "7Tab ^I Next context d Toggle detail view\n" + "6(Sh)Tab Next context d Toggle detail view\n" "9, ^/ Lead key N LeadN Context N\n" "c/ Filter/Lead Ins ^T Toggle nav-as-you-type\n" "aEsc Exit prompt ^L F5 Redraw/clear prompt\n" - "c? Help, config Lead' First file\n" + "c? Help, conf ' Lead' First file\n" "9Q ^Q Quit ^G QuitCD q Quit context\n" "1FILES\n" "b^O Open with... n Create new/link\n" @@ -3744,16 +3744,31 @@ nochange: goto begin; case SEL_LEADER: // fallthrough case SEL_CYCLE: // fallthrough + case SEL_CYCLER: // fallthrough + case SEL_FIRST: // fallthrough case SEL_CTX1: // fallthrough case SEL_CTX2: // fallthrough case SEL_CTX3: // fallthrough case SEL_CTX4: - if (sel == SEL_CYCLE) - fd = ']'; - else if (sel >= SEL_CTX1 && sel <= SEL_CTX4) + switch (sel) { + case SEL_CYCLE: + fd = '\t'; + break; + case SEL_CYCLER: + fd = KEY_BTAB; + break; + case SEL_FIRST: + fd = '\''; + break; + case SEL_CTX1: // fallthrough + case SEL_CTX2: // fallthrough + case SEL_CTX3: // fallthrough + case SEL_CTX4: fd = sel - SEL_CTX1 + '1'; - else + break; + default: fd = get_input(NULL); + } switch (fd) { case '~': // fallthrough @@ -3778,18 +3793,18 @@ nochange: if (ndents) copycurname(); goto begin; - case ']': // fallthrough - case '[': // fallthrough + case '\t': // fallthrough + case KEY_BTAB: /* visit next and previous contexts */ r = cfg.curctx; - if (fd == ']') + if (fd == '\t') do r = (r + 1) & ~CTX_MAX; while (!g_ctx[r].c_cfg.ctxactive); else do r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1); - while (!g_ctx[r].c_cfg.ctxactive); // fallthrough + while (!g_ctx[r].c_cfg.ctxactive); fd = '1' + r; // fallthrough case '1': // fallthrough case '2': // fallthrough @@ -47,6 +47,7 @@ enum action { SEL_CTRL_U, SEL_HOME, SEL_END, + SEL_FIRST, SEL_CDHOME, SEL_CDBEGIN, SEL_CDLAST, @@ -54,6 +55,7 @@ enum action { SEL_VISIT, SEL_LEADER, SEL_CYCLE, + SEL_CYCLER, SEL_CTX1, SEL_CTX2, SEL_CTX3, @@ -141,6 +143,8 @@ static struct key bindings[] = { { KEY_END, SEL_END }, { 'G', SEL_END }, { CONTROL('E'), SEL_END }, + /* Go to first file */ + { '\'', SEL_FIRST }, /* HOME */ { '~', SEL_CDHOME }, /* Initial directory */ @@ -155,8 +159,9 @@ static struct key bindings[] = { { CONTROL('_'), SEL_LEADER }, { ',', SEL_LEADER }, /* Cycle contexts in forward direction */ - { '\t', SEL_CYCLE }, - { CONTROL('I'), SEL_CYCLE }, + { '\t', SEL_CYCLE }, + /* Cycle contexts in reverse direction */ + { KEY_BTAB, SEL_CYCLER }, /* Go to/create context N */ { '1', SEL_CTX1 }, { '2', SEL_CTX2 }, |