Option -t replaces NNN_NO_AUTOSELECT

This commit is contained in:
Arun Prakash Jana 2019-08-17 00:07:38 +05:30
parent ac815c692a
commit e9f7b6aa6c
No known key found for this signature in database
GPG Key ID: A75979F35C080412
6 changed files with 17 additions and 20 deletions

View File

@ -224,7 +224,6 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd
| `NNN_OPENER=mimeopen` | custom file opener | | `NNN_OPENER=mimeopen` | custom file opener |
| `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] | | `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] |
| `NNN_COPIER=copier` | clipboard copier script [default: none] | | `NNN_COPIER=copier` | clipboard copier script [default: none] |
| `NNN_NO_AUTOSELECT=1` | do not auto-select matching dir in _nav-as-you-type_ mode |
| `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] | | `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] |
| `NNN_OPS_PROG=1` | show copy, move progress on Linux | | `NNN_OPS_PROG=1` | show copy, move progress on Linux |
@ -232,7 +231,7 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd
``` ```
usage: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o] usage: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]
[-p file] [-s] [-S] [-v] [-w] [-h] [PATH] [-p file] [-s] [-S] [-t] [-v] [-w] [-h] [PATH]
The missing terminal file manager for X. The missing terminal file manager for X.
@ -250,6 +249,7 @@ optional args:
-p file selection file (stdout if '-') -p file selection file (stdout if '-')
-s string filters [default: regex] -s string filters [default: regex]
-S du mode -S du mode
-t disable dir auto-select
-v show version -v show version
-w wild load -w wild load
-h show help -h show help
@ -392,9 +392,7 @@ There is a program option to filter entries by substring match instead of regex.
In this mode directories are opened in filter mode, allowing continuous navigation. Works best with the **arrow keys**. In this mode directories are opened in filter mode, allowing continuous navigation. Works best with the **arrow keys**.
When there's a unique match and it's a directory, `nnn` auto selects the directory and enters it in this mode. To disable this behaviour, When there's a unique match and it's a directory, `nnn` auto selects the directory and enters it in this mode. Use the relevant program option to disable this behaviour.
export NNN_NO_AUTOSELECT=1
This mode takes navigation to the next level when short, unique keypress sequences are possible. For example, to reach `nnn` development directory (located at `~/GitHub/nnn`) from my `$HOME` (which is the default directory the terminal starts in), I use the sequence <kbd>g</kbd><kbd>n</kbd>. This mode takes navigation to the next level when short, unique keypress sequences are possible. For example, to reach `nnn` development directory (located at `~/GitHub/nnn`) from my `$HOME` (which is the default directory the terminal starts in), I use the sequence <kbd>g</kbd><kbd>n</kbd>.

View File

@ -21,6 +21,7 @@ _nnn () {
-p -p
-s -s
-S -S
-t
-v -v
-w -w
-h -h

View File

@ -15,6 +15,7 @@ complete -c nnn -s o -d 'open files only on Enter'
complete -c nnn -s p -r -d 'copy selection to file' complete -c nnn -s p -r -d 'copy selection to file'
complete -c nnn -s s -d 'use substring match for filters' complete -c nnn -s s -d 'use substring match for filters'
complete -c nnn -s S -d 'start in disk usage analyzer mode' 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 'show program version and exit'
complete -c nnn -s w -d 'wild load' complete -c nnn -s w -d 'wild load'
complete -c nnn -s h -d 'show program help' complete -c nnn -s h -d 'show program help'

View File

@ -19,6 +19,7 @@ args=(
'(-p)-p[copy selection to file]:file name' '(-p)-p[copy selection to file]:file name'
'(-s)-s[use substring match for filters]' '(-s)-s[use substring match for filters]'
'(-S)-S[start in disk usage analyzer mode]' '(-S)-S[start in disk usage analyzer mode]'
'(-t)-t[disable dir auto-select]'
'(-v)-v[show program version and exit]' '(-v)-v[show program version and exit]'
'(-w)-w[wild load]' '(-w)-w[wild load]'
'(-h)-h[show program help]' '(-h)-h[show program help]'

8
nnn.1
View File

@ -67,6 +67,9 @@ supports the following options:
.Fl S .Fl S
start in disk usage analyzer mode start in disk usage analyzer mode
.Pp .Pp
.Fl t
disable directory auto-select in navigate-as-you-type mode
.Pp
.Fl v .Fl v
show version and exit show version and exit
.Pp .Pp
@ -194,11 +197,6 @@ files.
.Pp .Pp
\fBNNN_COPIER:\fR system clipboard copier script. The project page has some sample copier scripts. \fBNNN_COPIER:\fR system clipboard copier script. The project page has some sample copier scripts.
.Pp .Pp
\fBNNN_NO_AUTOSELECT:\fR disable directory auto-selection in \fInavigate-as-you-type\fR mode.
.Bd -literal
export NNN_NO_AUTOSELECT=1
.Ed
.Pp
\fBNNN_TRASH:\fR trash (instead of \fIdelete\fR) files to desktop Trash. \fBNNN_TRASH:\fR trash (instead of \fIdelete\fR) files to desktop Trash.
.Bd -literal .Bd -literal
export NNN_TRASH=1 export NNN_TRASH=1

View File

@ -404,10 +404,9 @@ static const char * const messages[] = {
#define NNN_NOTE 5 #define NNN_NOTE 5
#define NNNLVL 6 /* strings end here */ #define NNNLVL 6 /* strings end here */
#define NNN_USE_EDITOR 7 /* flags begin here */ #define NNN_USE_EDITOR 7 /* flags begin here */
#define NNN_NO_AUTOSELECT 8 #define NNN_TRASH 8
#define NNN_TRASH 9
#ifdef __linux__ #ifdef __linux__
#define NNN_OPS_PROG 10 #define NNN_OPS_PROG 9
#endif #endif
static const char * const env_cfg[] = { static const char * const env_cfg[] = {
@ -419,7 +418,6 @@ static const char * const env_cfg[] = {
"NNN_NOTE", "NNN_NOTE",
"NNNLVL", "NNNLVL",
"NNN_USE_EDITOR", "NNN_USE_EDITOR",
"NNN_NO_AUTOSELECT",
"NNN_TRASH", "NNN_TRASH",
#ifdef __linux__ #ifdef __linux__
"NNN_OPS_PROG", "NNN_OPS_PROG",
@ -4575,7 +4573,7 @@ static void usage(void)
{ {
fprintf(stdout, fprintf(stdout,
"%s: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]\n" "%s: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]\n"
" [-p file] [-s] [-S] [-v] [-w] [-h] [PATH]\n\n" " [-p file] [-s] [-S] [-t] [-v] [-w] [-h] [PATH]\n\n"
"The missing terminal file manager for X.\n\n" "The missing terminal file manager for X.\n\n"
"positional args:\n" "positional args:\n"
" PATH start dir [default: current dir]\n\n" " PATH start dir [default: current dir]\n\n"
@ -4590,6 +4588,7 @@ static void usage(void)
" -p file selection file (stdout if '-')\n" " -p file selection file (stdout if '-')\n"
" -s string filters [default: regex]\n" " -s string filters [default: regex]\n"
" -S du mode\n" " -S du mode\n"
" -t disable dir auto-select\n"
" -v show version\n" " -v show version\n"
" -w wild load\n" " -w wild load\n"
" -h show help\n\n" " -h show help\n\n"
@ -4722,7 +4721,7 @@ int main(int argc, char *argv[])
char *arg = NULL; char *arg = NULL;
int opt; int opt;
while ((opt = getopt(argc, argv, "HSib:denop:svwh")) != -1) { while ((opt = getopt(argc, argv, "HSib:denop:stvwh")) != -1) {
switch (opt) { switch (opt) {
case 'S': case 'S':
cfg.blkorder = 1; cfg.blkorder = 1;
@ -4772,6 +4771,9 @@ int main(int argc, char *argv[])
cfg.filter_re = 0; cfg.filter_re = 0;
filterfn = &visible_str; filterfn = &visible_str;
break; break;
case 't':
cfg.autoselect = 0;
break;
case 'v': case 'v':
fprintf(stdout, "%s\n", VERSION); fprintf(stdout, "%s\n", VERSION);
return _SUCCESS; return _SUCCESS;
@ -4934,10 +4936,6 @@ int main(int argc, char *argv[])
/* Get the clipboard copier, if set */ /* Get the clipboard copier, if set */
copier = getenv(env_cfg[NNN_COPIER]); copier = getenv(env_cfg[NNN_COPIER]);
/* Disable auto-select if opted */
if (xgetenv_set(env_cfg[NNN_NO_AUTOSELECT]))
cfg.autoselect = 0;
#ifdef __linux__ #ifdef __linux__
if (!xgetenv_set(env_cfg[NNN_OPS_PROG])) { if (!xgetenv_set(env_cfg[NNN_OPS_PROG])) {
cp[5] = cp[4]; cp[5] = cp[4];