mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Option -o replaces NNN_RESTRICT_NAV_OPEN
This commit is contained in:
parent
e13481c5b0
commit
ac815c692a
|
@ -225,14 +225,13 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd
|
||||||
| `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_NO_AUTOSELECT=1` | do not auto-select matching dir in _nav-as-you-type_ mode |
|
||||||
| `NNN_RESTRICT_NAV_OPEN=1` | open files on <kbd> ↵</kbd>, not <kbd>→</kbd> or <kbd>l</kbd> |
|
|
||||||
| `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 |
|
||||||
|
|
||||||
#### Cmdline options
|
#### 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]
|
[-p file] [-s] [-S] [-v] [-w] [-h] [PATH]
|
||||||
|
|
||||||
The missing terminal file manager for X.
|
The missing terminal file manager for X.
|
||||||
|
@ -247,6 +246,7 @@ optional args:
|
||||||
-H show hidden files
|
-H show hidden files
|
||||||
-i nav-as-you-type mode
|
-i nav-as-you-type mode
|
||||||
-n version sort
|
-n version sort
|
||||||
|
-o press Enter to open files
|
||||||
-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
|
||||||
|
|
|
@ -17,6 +17,7 @@ _nnn () {
|
||||||
-H
|
-H
|
||||||
-i
|
-i
|
||||||
-n
|
-n
|
||||||
|
-o
|
||||||
-p
|
-p
|
||||||
-s
|
-s
|
||||||
-S
|
-S
|
||||||
|
|
|
@ -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 H -d 'show hidden files'
|
||||||
complete -c nnn -s i -d 'start in navigate-as-you-type mode'
|
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 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 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'
|
||||||
|
|
|
@ -15,6 +15,7 @@ args=(
|
||||||
'(-H)-H[show hidden files]'
|
'(-H)-H[show hidden files]'
|
||||||
'(-i)-i[start in navigate-as-you-type mode]'
|
'(-i)-i[start in navigate-as-you-type mode]'
|
||||||
'(-n)-n[use version compare to sort files]'
|
'(-n)-n[use version compare to sort files]'
|
||||||
|
'(-o)-o[open files only on Enter]'
|
||||||
'(-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]'
|
||||||
|
|
8
nnn.1
8
nnn.1
|
@ -55,6 +55,9 @@ supports the following options:
|
||||||
.Fl n
|
.Fl n
|
||||||
use case-insensitive version compare to sort files
|
use case-insensitive version compare to sort files
|
||||||
.Pp
|
.Pp
|
||||||
|
.Fl o
|
||||||
|
open files only on Enter key
|
||||||
|
.Pp
|
||||||
.Fl "p file"
|
.Fl "p file"
|
||||||
copy (or \fIpick\fR) selection to file, or stdout if file='-'
|
copy (or \fIpick\fR) selection to file, or stdout if file='-'
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -196,11 +199,6 @@ files.
|
||||||
export NNN_NO_AUTOSELECT=1
|
export NNN_NO_AUTOSELECT=1
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.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.
|
\fBNNN_TRASH:\fR trash (instead of \fIdelete\fR) files to desktop Trash.
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
export NNN_TRASH=1
|
export NNN_TRASH=1
|
||||||
|
|
18
src/nnn.c
18
src/nnn.c
|
@ -405,10 +405,9 @@ static const char * const messages[] = {
|
||||||
#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_NO_AUTOSELECT 8
|
||||||
#define NNN_RESTRICT_NAV_OPEN 9
|
#define NNN_TRASH 9
|
||||||
#define NNN_TRASH 10
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define NNN_OPS_PROG 11
|
#define NNN_OPS_PROG 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char * const env_cfg[] = {
|
static const char * const env_cfg[] = {
|
||||||
|
@ -421,7 +420,6 @@ static const char * const env_cfg[] = {
|
||||||
"NNNLVL",
|
"NNNLVL",
|
||||||
"NNN_USE_EDITOR",
|
"NNN_USE_EDITOR",
|
||||||
"NNN_NO_AUTOSELECT",
|
"NNN_NO_AUTOSELECT",
|
||||||
"NNN_RESTRICT_NAV_OPEN",
|
|
||||||
"NNN_TRASH",
|
"NNN_TRASH",
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
"NNN_OPS_PROG",
|
"NNN_OPS_PROG",
|
||||||
|
@ -4576,7 +4574,7 @@ nochange:
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stdout,
|
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"
|
" [-p file] [-s] [-S] [-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"
|
||||||
|
@ -4588,6 +4586,7 @@ static void usage(void)
|
||||||
" -H show hidden files\n"
|
" -H show hidden files\n"
|
||||||
" -i nav-as-you-type mode\n"
|
" -i nav-as-you-type mode\n"
|
||||||
" -n version sort\n"
|
" -n version sort\n"
|
||||||
|
" -o press Enter to open files\n"
|
||||||
" -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"
|
||||||
|
@ -4723,7 +4722,7 @@ int main(int argc, char *argv[])
|
||||||
char *arg = NULL;
|
char *arg = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "HSib:denp:svwh")) != -1) {
|
while ((opt = getopt(argc, argv, "HSib:denop:svwh")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'S':
|
case 'S':
|
||||||
cfg.blkorder = 1;
|
cfg.blkorder = 1;
|
||||||
|
@ -4749,6 +4748,9 @@ int main(int argc, char *argv[])
|
||||||
case 'n':
|
case 'n':
|
||||||
cmpfn = &xstrverscasecmp;
|
cmpfn = &xstrverscasecmp;
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
cfg.nonavopen = 1;
|
||||||
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
cfg.picker = 1;
|
cfg.picker = 1;
|
||||||
if (optarg[0] == '-' && optarg[1] == '\0')
|
if (optarg[0] == '-' && optarg[1] == '\0')
|
||||||
|
@ -4936,10 +4938,6 @@ int main(int argc, char *argv[])
|
||||||
if (xgetenv_set(env_cfg[NNN_NO_AUTOSELECT]))
|
if (xgetenv_set(env_cfg[NNN_NO_AUTOSELECT]))
|
||||||
cfg.autoselect = 0;
|
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__
|
#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];
|
||||||
|
|
Loading…
Reference in a new issue