README.md | 4 ++-- misc/auto-completion/bash/nnn-completion.bash | 1 + misc/auto-completion/fish/nnn.fish | 1 + misc/auto-completion/zsh/_nnn | 1 + nnn.1 | 8 +++----- src/nnn.c | 18 ++++++++---------- diff --git a/README.md b/README.md index dabb8318dfdadac314f75d0c9d2de65026d78d9e..d57d332428971bfbee8882198bb58ed40c865107 100644 --- a/README.md +++ b/README.md @@ -225,14 +225,13 @@ | `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_RESTRICT_NAV_OPEN=1` | open files on , not or l | | `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] | | `NNN_OPS_PROG=1` | show copy, move progress on Linux | #### Cmdline options ``` -usage: nnn [-b key] [-d] [-e] [-H] [-i] [-n] +usage: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o] [-p file] [-s] [-S] [-v] [-w] [-h] [PATH] The missing terminal file manager for X. @@ -247,6 +246,7 @@ -e use exiftool for media info -H show hidden files -i nav-as-you-type mode -n version sort + -o press Enter to open files -p file selection file (stdout if '-') -s string filters [default: regex] -S du mode diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash index d15ee3b7b81bb9cca566c714ae39de25e2a143f5..35448edde0026304901a67741297b0bc3986ef7d 100644 --- a/misc/auto-completion/bash/nnn-completion.bash +++ b/misc/auto-completion/bash/nnn-completion.bash @@ -17,6 +17,7 @@ -e -H -i -n + -o -p -s -S diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish index a3d836a1927e8aa10056438b0e4e15df7e21da61..c7a7b8b57e47f37e9e1d6903eaa2d706e986d296 100644 --- a/misc/auto-completion/fish/nnn.fish +++ b/misc/auto-completion/fish/nnn.fish @@ -11,6 +11,7 @@ complete -c nnn -s e -d 'use exiftool instead of mediainfo' 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 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' complete -c nnn -s s -d 'use substring match for filters' complete -c nnn -s S -d 'start in disk usage analyzer mode' diff --git a/misc/auto-completion/zsh/_nnn b/misc/auto-completion/zsh/_nnn index 900b20e440c34b9a418162642ec0eb119aa9ea42..5438b6bd96f9e2b31706e3301ca1a52532f00d22 100644 --- a/misc/auto-completion/zsh/_nnn +++ b/misc/auto-completion/zsh/_nnn @@ -15,6 +15,7 @@ '(-e)-e[use exiftool instead of mediainfo]' '(-H)-H[show hidden files]' '(-i)-i[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' '(-s)-s[use substring match for filters]' '(-S)-S[start in disk usage analyzer mode]' diff --git a/nnn.1 b/nnn.1 index 3d577672a82b5eb973b75e60207a62cf6cd2a2e8..d08d667c557dbce75be2d3ee0d23a9224ad8cc08 100644 --- a/nnn.1 +++ b/nnn.1 @@ -55,6 +55,9 @@ .Pp .Fl n use case-insensitive version compare to sort files .Pp +.Fl o + open files only on Enter key +.Pp .Fl "p file" copy (or \fIpick\fR) selection to file, or stdout if file='-' .Pp @@ -194,11 +197,6 @@ .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_RESTRICT_NAV_OPEN:\fR disable file open on \fBRight\fR or \fBl\fR keys (\fBEnter\fR opens files). -.Bd -literal - export NNN_RESTRICT_NAV_OPEN=1 .Ed .Pp \fBNNN_TRASH:\fR trash (instead of \fIdelete\fR) files to desktop Trash. diff --git a/src/nnn.c b/src/nnn.c index f60384ccbb9f3b07b77c1c10b6b1168c2717c753..690f16e9fadc7f5bbf86a2f4130801be709e5ff9 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -405,10 +405,9 @@ #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_RESTRICT_NAV_OPEN 9 -#define NNN_TRASH 10 +#define NNN_TRASH 9 #ifdef __linux__ -#define NNN_OPS_PROG 11 +#define NNN_OPS_PROG 10 #endif static const char * const env_cfg[] = { @@ -421,7 +420,6 @@ "NNN_NOTE", "NNNLVL", "NNN_USE_EDITOR", "NNN_NO_AUTOSELECT", - "NNN_RESTRICT_NAV_OPEN", "NNN_TRASH", #ifdef __linux__ "NNN_OPS_PROG", @@ -4576,7 +4574,7 @@ static void usage(void) { fprintf(stdout, - "%s: nnn [-b key] [-d] [-e] [-H] [-i] [-n]\n" + "%s: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]\n" " [-p file] [-s] [-S] [-v] [-w] [-h] [PATH]\n\n" "The missing terminal file manager for X.\n\n" "positional args:\n" @@ -4588,6 +4586,7 @@ " -e use exiftool for media info\n" " -H show hidden files\n" " -i nav-as-you-type mode\n" " -n version sort\n" + " -o press Enter to open files\n" " -p file selection file (stdout if '-')\n" " -s string filters [default: regex]\n" " -S du mode\n" @@ -4723,7 +4722,7 @@ { char *arg = NULL; int opt; - while ((opt = getopt(argc, argv, "HSib:denp:svwh")) != -1) { + while ((opt = getopt(argc, argv, "HSib:denop:svwh")) != -1) { switch (opt) { case 'S': cfg.blkorder = 1; @@ -4748,6 +4747,9 @@ cfg.showhidden = 1; break; case 'n': cmpfn = &xstrverscasecmp; + break; + case 'o': + cfg.nonavopen = 1; break; case 'p': cfg.picker = 1; @@ -4935,10 +4937,6 @@ /* Disable auto-select if opted */ if (xgetenv_set(env_cfg[NNN_NO_AUTOSELECT])) cfg.autoselect = 0; - - /* Disable opening files on right arrow and `l` */ - if (xgetenv_set(env_cfg[NNN_RESTRICT_NAV_OPEN])) - cfg.nonavopen = 1; #ifdef __linux__ if (!xgetenv_set(env_cfg[NNN_OPS_PROG])) {