misc/auto-completion/bash/nnn-completion.bash | 2 +- misc/auto-completion/fish/nnn.fish | 4 ++-- misc/auto-completion/zsh/_nnn | 4 ++-- nnn.1 | 10 +++++----- src/nnn.c | 45 ++++++++++++++++++++++----------------------- src/nnn.h | 11 +++++++---- diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash index 86102bd4606d2b01881e91b6baa880974a7896b9..22da4af37948063afd45cf870c50997615fc38f4 100644 --- a/misc/auto-completion/bash/nnn-completion.bash +++ b/misc/auto-completion/bash/nnn-completion.bash @@ -19,6 +19,7 @@ -d -E -g -H + -i -K -n -o @@ -30,7 +31,6 @@ -s -S -t -v - -V -x -h ) diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish index f597886e6063cf44131287c848965317ab7e8e5b..c71d33cc7263ce04f6faa7a7678f473956e57221 100644 --- a/misc/auto-completion/fish/nnn.fish +++ b/misc/auto-completion/fish/nnn.fish @@ -18,8 +18,9 @@ complete -c nnn -s d -d 'start in detail mode' complete -c nnn -s E -d 'use EDITOR for undetached edits' complete -c nnn -s g -d 'regex filters' complete -c nnn -s H -d 'show hidden files' +complete -c nnn -s i -d 'start in navigate-as-you-type mode' complete -c nnn -s K -d 'detect key collision' -complete -c nnn -s n -d 'start in navigate-as-you-type mode' +complete -c nnn -s n -d 'use version compare to sort files' complete -c nnn -s o -d 'open files only on Enter' complete -c nnn -s p -r -d 'copy selection to file' -a '-\tstdout' complete -c nnn -s Q -d 'disable quit confirmation' @@ -29,6 +30,5 @@ complete -c nnn -s s -r -d 'load session by name' -x -a '@\t"last session" (ls $sessions_dir)' complete -c nnn -s S -d 'start in disk usage analyzer mode' complete -c nnn -s t -d 'disable dir auto-select' complete -c nnn -s v -d 'show program version and exit' -complete -c nnn -s V -d 'use version compare to sort files' complete -c nnn -s x -d 'notis, sel to system clipboard' complete -c nnn -s h -d 'show program help' diff --git a/misc/auto-completion/zsh/_nnn b/misc/auto-completion/zsh/_nnn index a8b5f23884f18b9823604b19d06eb3edf268f61b..c37012c8024e77e1332d892c9e2fcb63f2c07b0e 100644 --- a/misc/auto-completion/zsh/_nnn +++ b/misc/auto-completion/zsh/_nnn @@ -16,8 +16,9 @@ '(-d)-d[start in detail mode]' '(-E)-E[use EDITOR for undetached edits]' '(-g)-g[regex filters]' '(-H)-H[show hidden files]' + '(-i)-i[start in navigate-as-you-type mode]' '(-K)-K[detect key collision]' - '(-n)-n[start in navigate-as-you-type mode]' + '(-n)-n[use version compare to sort files]' '(-o)-o[open files only on Enter]' '(-p)-p[copy selection to file]:file name' '(-Q)-Q[disable quit confirmation]' @@ -27,7 +28,6 @@ '(-s)-s[load session]:session name' '(-S)-S[start in disk usage analyzer mode]' '(-t)-t[disable dir auto-select]' '(-v)-v[show program version and exit]' - '(-V)-V[use version compare to sort files]' '(-x)-x[notis, sel to system clipboard]' '(-h)-h[show program help]' '*:filename:_files' diff --git a/nnn.1 b/nnn.1 index 0a236add4bcc51897fbc6694a9ddaef6297ecf01..6782c5ea43379f7ea4954ad9e330836d2dba4a74 100644 --- a/nnn.1 +++ b/nnn.1 @@ -13,6 +13,7 @@ .Op Ar -d .Op Ar -E .Op Ar -g .Op Ar -H +.Op Ar -i .Op Ar -K .Op Ar -n .Op Ar -p file @@ -22,7 +23,6 @@ .Op Ar -R .Op Ar -s name .Op Ar -S .Op Ar -v -.Op Ar -V .Op Ar -x .Op Ar -h .Op Ar PATH @@ -64,12 +64,15 @@ use regex filters instead of substring match .Pp .Fl H show hidden files +.Pp +.Fl i + start in navigate-as-you-type mode .Pp .Fl K test for keybind collision .Pp .Fl n - start in navigate-as-you-type mode + use case-insensitive version compare to sort files .Pp .Fl o open files only on Enter key @@ -97,9 +100,6 @@ disable directory auto-select in navigate-as-you-type mode .Pp .Fl v show version and exit -.Pp -.Fl V - use case-insensitive version compare to sort files .Pp .Fl x show notis on selection cp, mv, rm completion; copy path to system clipboard on select diff --git a/src/nnn.c b/src/nnn.c index 5e19413e1ac4b77650e540f8da7e9c3b4c68806e..0c72e8aaa270b6b1debe387d620668653c8121d2 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -3473,13 +3473,14 @@ "7Down j Down%-14cPgDn ^D Scroll down\n" "7Left h Parent%-12c~ ` @ - HOME, /, start, last\n" "9g ^A Top%-11cRet Right l Open\n" "9G ^E End%-21c' First file\n" - "c, Pin CWD%-17c. Toggle hidden\n" - "9b ^B Go to bookmark%-10cd Detail view toggle\n" + "cb Pin CWD%-16c^B Go to pinned dir\n" + "9, ^/ Go to bookmark%-10cd Detail view toggle\n" "6(Sh)Tab Cycle context%-11cN Context N\n" - "c/ Filter%-14c^/ ^N Nav-as-you-type toggle\n" + "c/ Filter%-13cIns ^N Nav-as-you-type toggle\n" "aEsc Exit prompt%-9c^L F5 Redraw/clear prompt\n" - "b^G QuitCD%-18c? Help, conf\n" + "c. Toggle hidden%-11c? Help, conf\n" "9Q ^Q Quit%-20cq Quit context\n" + "b^G QuitCD%-1c\n" "1FILES\n" "b^O Open with...%-12cn Create new/link\n" "cD File details%-8c^R F2 Rename/duplicate\n" @@ -4542,7 +4543,8 @@ break; case SEL_CDHOME: // fallthrough case SEL_CDBEGIN: // fallthrough case SEL_CDLAST: // fallthrough - case SEL_CDROOT: + case SEL_CDROOT: // fallthrough + case SEL_VISIT: switch (sel) { case SEL_CDHOME: dir = home; @@ -4553,8 +4555,11 @@ break; case SEL_CDLAST: dir = lastdir; break; - default: /* SEL_CDROOT */ + case SEL_CDROOT: dir = "/"; + break; + default: /* case SEL_VISIT */ + dir = mark; break; } @@ -4634,18 +4639,12 @@ case SEL_BOOKMARK: xstrlcpy(g_buf, messages[MSG_BOOKMARK_KEYS], CMD_LEN_MAX); printkeys(bookmark, g_buf + strlen(g_buf), BM_MAX); printprompt(g_buf); - r = get_input(NULL); + fd = get_input(NULL); - if (!get_kv_val(bookmark, newpath, r, BM_MAX, TRUE)) { - if (r == ',' && mark[0]) - xstrlcpy(newpath, mark, PATH_MAX); - else { - printwait(messages[MSG_INVALID_KEY], &presel);; - goto nochange; - } + if (!get_kv_val(bookmark, newpath, fd, BM_MAX, TRUE)) { + printwait(messages[MSG_INVALID_KEY], &presel);; + goto nochange; } - - if (!xdiraccess(newpath)) { printwait(messages[MSG_ACCESS], &presel); @@ -5467,8 +5466,9 @@ " -d detail mode\n" " -E use EDITOR for undetached edits\n" " -g regex filters [default: string]\n" " -H show hidden files\n" + " -i nav-as-you-type mode\n" " -K detect key collision\n" - " -n nav-as-you-type mode\n" + " -n version sort\n" " -o open files on Enter\n" " -p file selection file [stdout if '-']\n" " -Q no quit confirmation\n" @@ -5478,7 +5478,6 @@ " -s name load session by name\n" " -S du mode\n" " -t no dir auto-select\n" " -v show version\n" - " -V version sort\n" " -x notis, sel to system clipboard\n" " -h show help\n\n" "v%s\n%s\n", __func__, VERSION, GENERAL_INFO); @@ -5622,7 +5621,7 @@ #ifdef __linux__ bool progress = FALSE; #endif - while ((opt = getopt(argc, argv, "HSKab:cdEgnop:QrRs:tvVxh")) != -1) { + while ((opt = getopt(argc, argv, "HSKiab:cdEgnop:QrRs:tvxh")) != -1) { switch (opt) { case 'S': cfg.blkorder = 1; @@ -5631,6 +5630,9 @@ blk_shift = ffs(S_BLKSIZE) - 1; // fallthrough case 'd': cfg.showdetail = 1; printptr = &printent_long; + break; + case 'i': + cfg.filtermode = 1; break; case 'a': cfg.mtime = 0; @@ -5652,7 +5654,7 @@ case 'H': cfg.showhidden = 1; break; case 'n': - cfg.filtermode = 1; + cmpfn = &xstrverscasecmp; break; case 'o': cfg.nonavopen = 1; @@ -5697,9 +5699,6 @@ return _SUCCESS; case 'v': fprintf(stdout, "%s\n", VERSION); return _SUCCESS; - case 'V': - cmpfn = &xstrverscasecmp; - break; case 'x': cfg.x11 = 1; break; diff --git a/src/nnn.h b/src/nnn.h index e4e9f4a212b0ab55e1e1195116ed5de3b488918c..0a917468eac65d0f3b1bf05546b369dc87cacbb6 100644 --- a/src/nnn.h +++ b/src/nnn.h @@ -52,6 +52,7 @@ SEL_CDHOME, SEL_CDBEGIN, SEL_CDLAST, SEL_CDROOT, + SEL_VISIT, SEL_CYCLE, SEL_CYCLER, SEL_CTX1, @@ -154,6 +155,8 @@ /* Last visited dir */ { '-', SEL_CDLAST }, /* Go to / */ { '`', SEL_CDROOT }, + /* Visit marked directory */ + { CONTROL('B'), SEL_VISIT }, /* Cycle contexts in forward direction */ { '\t', SEL_CYCLE }, /* Cycle contexts in reverse direction */ @@ -164,15 +167,15 @@ { '2', SEL_CTX2 }, { '3', SEL_CTX3 }, { '4', SEL_CTX4 }, /* Bookmark key */ - { 'b', SEL_BOOKMARK }, - { CONTROL('B'), SEL_BOOKMARK }, + { CONTROL('_'), SEL_BOOKMARK }, + { ',', SEL_BOOKMARK }, /* Mark a path to visit later */ - { ',', SEL_PIN }, + { 'b', SEL_PIN }, /* Filter */ { '/', SEL_FLTR }, /* Toggle filter mode */ { KEY_IC, SEL_MFLTR }, - { CONTROL('_'), SEL_MFLTR }, + { CONTROL('N'), SEL_MFLTR }, /* Toggle hide .dot files */ { '.', SEL_TOGGLEDOT }, /* Detailed listing */