Add keys: Shift+TAB, '

This commit is contained in:
Arun Prakash Jana 2019-10-05 06:59:43 +05:30
parent 9dab803e1a
commit 14c355bacf
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 34 additions and 16 deletions

View file

@ -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 ↵ → l Open file/dir . Toggle show hidden
g ^A First entry G ^E Last entry g ^A First entry G ^E Last entry
b Pin current dir ^B Go to pinned dir 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 , ^/ Lead key N LeadN Context N
/ Filter/Lead Ins ^T Toggle nav-as-you-type / Filter/Lead Ins ^T Toggle nav-as-you-type
Esc Exit prompt ^L F5 Redraw/clear prompt 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 Q ^Q Quit ^G QuitCD q Quit context
FILES FILES
^O Open with... n Create new/link ^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 | | Key | Function |
|:---:| --- | |:---:| --- |
| <kbd>1-4</kbd> | Go to/create selected context | | <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 | | key | Go to bookmarked location |
| <kbd>'</kbd> | Go to first file in directory | | <kbd>'</kbd> | Go to first file in directory |
| <kbd>~</kbd> <kbd>`</kbd> <kbd>@</kbd> <kbd>-</kbd> | Visit HOME, `/`, start, last visited dir | | <kbd>~</kbd> <kbd>`</kbd> <kbd>@</kbd> <kbd>-</kbd> | Visit HOME, `/`, start, last visited dir |

View file

@ -2823,11 +2823,11 @@ static void show_help(const char *path)
"8↵ → l Open file/dir . Toggle show hidden\n" "8↵ → l Open file/dir . Toggle show hidden\n"
"9g ^A First entry G ^E Last entry\n" "9g ^A First entry G ^E Last entry\n"
"cb Pin current dir ^B Go to pinned dir\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" "9, ^/ Lead key N LeadN Context N\n"
"c/ Filter/Lead Ins ^T Toggle nav-as-you-type\n" "c/ Filter/Lead Ins ^T Toggle nav-as-you-type\n"
"aEsc Exit prompt ^L F5 Redraw/clear prompt\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" "9Q ^Q Quit ^G QuitCD q Quit context\n"
"1FILES\n" "1FILES\n"
"b^O Open with... n Create new/link\n" "b^O Open with... n Create new/link\n"
@ -3744,16 +3744,31 @@ nochange:
goto begin; goto begin;
case SEL_LEADER: // fallthrough case SEL_LEADER: // fallthrough
case SEL_CYCLE: // fallthrough case SEL_CYCLE: // fallthrough
case SEL_CYCLER: // fallthrough
case SEL_FIRST: // fallthrough
case SEL_CTX1: // fallthrough case SEL_CTX1: // fallthrough
case SEL_CTX2: // fallthrough case SEL_CTX2: // fallthrough
case SEL_CTX3: // fallthrough case SEL_CTX3: // fallthrough
case SEL_CTX4: case SEL_CTX4:
if (sel == SEL_CYCLE) switch (sel) {
fd = ']'; case SEL_CYCLE:
else if (sel >= SEL_CTX1 && sel <= SEL_CTX4) 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'; fd = sel - SEL_CTX1 + '1';
else break;
default:
fd = get_input(NULL); fd = get_input(NULL);
}
switch (fd) { switch (fd) {
case '~': // fallthrough case '~': // fallthrough
@ -3778,18 +3793,18 @@ nochange:
if (ndents) if (ndents)
copycurname(); copycurname();
goto begin; goto begin;
case ']': // fallthrough case '\t': // fallthrough
case '[': // fallthrough case KEY_BTAB:
/* visit next and previous contexts */ /* visit next and previous contexts */
r = cfg.curctx; r = cfg.curctx;
if (fd == ']') if (fd == '\t')
do do
r = (r + 1) & ~CTX_MAX; r = (r + 1) & ~CTX_MAX;
while (!g_ctx[r].c_cfg.ctxactive); while (!g_ctx[r].c_cfg.ctxactive);
else else
do do
r = (r + (CTX_MAX - 1)) & (CTX_MAX - 1); 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 fd = '1' + r; // fallthrough
case '1': // fallthrough case '1': // fallthrough
case '2': // fallthrough case '2': // fallthrough

View file

@ -47,6 +47,7 @@ enum action {
SEL_CTRL_U, SEL_CTRL_U,
SEL_HOME, SEL_HOME,
SEL_END, SEL_END,
SEL_FIRST,
SEL_CDHOME, SEL_CDHOME,
SEL_CDBEGIN, SEL_CDBEGIN,
SEL_CDLAST, SEL_CDLAST,
@ -54,6 +55,7 @@ enum action {
SEL_VISIT, SEL_VISIT,
SEL_LEADER, SEL_LEADER,
SEL_CYCLE, SEL_CYCLE,
SEL_CYCLER,
SEL_CTX1, SEL_CTX1,
SEL_CTX2, SEL_CTX2,
SEL_CTX3, SEL_CTX3,
@ -141,6 +143,8 @@ static struct key bindings[] = {
{ KEY_END, SEL_END }, { KEY_END, SEL_END },
{ 'G', SEL_END }, { 'G', SEL_END },
{ CONTROL('E'), SEL_END }, { CONTROL('E'), SEL_END },
/* Go to first file */
{ '\'', SEL_FIRST },
/* HOME */ /* HOME */
{ '~', SEL_CDHOME }, { '~', SEL_CDHOME },
/* Initial directory */ /* Initial directory */
@ -155,8 +159,9 @@ static struct key bindings[] = {
{ CONTROL('_'), SEL_LEADER }, { CONTROL('_'), SEL_LEADER },
{ ',', SEL_LEADER }, { ',', SEL_LEADER },
/* Cycle contexts in forward direction */ /* Cycle contexts in forward direction */
{ '\t', SEL_CYCLE }, { '\t', SEL_CYCLE },
{ CONTROL('I'), SEL_CYCLE }, /* Cycle contexts in reverse direction */
{ KEY_BTAB, SEL_CYCLER },
/* Go to/create context N */ /* Go to/create context N */
{ '1', SEL_CTX1 }, { '1', SEL_CTX1 },
{ '2', SEL_CTX2 }, { '2', SEL_CTX2 },