aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c35
-rw-r--r--src/nnn.h9
2 files changed, 32 insertions, 12 deletions
diff --git a/src/nnn.c b/src/nnn.c
index b1c15cc..9bc8591 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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
diff --git a/src/nnn.h b/src/nnn.h
index e2a9a62..ad6a026 100644
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -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 },