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_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] |
| `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_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]
[-p file] [-s] [-S] [-v] [-w] [-h] [PATH]
[-p file] [-s] [-S] [-t] [-v] [-w] [-h] [PATH]
The missing terminal file manager for X.
@ -250,6 +249,7 @@ optional args:
-p file selection file (stdout if '-')
-s string filters [default: regex]
-S du mode
-t disable dir auto-select
-v show version
-w wild load
-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**.
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,
export NNN_NO_AUTOSELECT=1
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.
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
-s
-S
-t
-v
-w
-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 s -d 'use substring match for filters'
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 w -d 'wild load'
complete -c nnn -s h -d 'show program help'

View File

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

8
nnn.1
View File

@ -67,6 +67,9 @@ supports the following options:
.Fl S
start in disk usage analyzer mode
.Pp
.Fl t
disable directory auto-select in navigate-as-you-type mode
.Pp
.Fl v
show version and exit
.Pp
@ -194,11 +197,6 @@ files.
.Pp
\fBNNN_COPIER:\fR system clipboard copier script. The project page has some sample copier scripts.
.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.
.Bd -literal
export NNN_TRASH=1

View File

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