Option -d to show hidden files.

NNN_SHOW_HIDDEN is removed.
This commit is contained in:
Arun Prakash Jana 2019-03-11 20:21:41 +05:30
parent 8882aa8022
commit 2e07a20d23
No known key found for this signature in database
GPG key ID: A75979F35C080412
3 changed files with 16 additions and 24 deletions

View file

@ -206,6 +206,7 @@ positional args:
optional args:
-b key open bookmark key
-d show hidden files
-e use exiftool for media info
-i nav-as-you-type mode
-l light mode
@ -332,8 +333,6 @@ Common use cases:
There is a program option to filter entries by substring match instead of regex.
If `nnn` is invoked as root or the environment variable `NNN_SHOW_HIDDEN` is set the default filter will also match hidden files.
#### Navigate-as-you-type
In this mode directories are opened in filter mode, allowing continuous navigation. Works best with the **arrow keys**.
@ -375,7 +374,6 @@ The following indicators are used in the detail view:
| `NNN_NOTE=/home/user/Dropbox/Public/notes` | path to note file [default: none] |
| `NNN_TMPFILE=/tmp/nnn` | file to write current open dir path to for cd on quit |
| `NNN_USE_EDITOR=1` | Open text files in `$EDITOR` (`$VISUAL`, if defined; fallback vi) |
| `NNN_SHOW_HIDDEN=1` | show hidden (.) files [default: do not show hidden if not root ] |
| `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_RESTRICT_0B=1` | do not open 0-byte files |

13
nnn.1
View file

@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Ar -b key
.Op Ar -d
.Op Ar -e
.Op Ar -i
.Op Ar -l
@ -173,6 +174,9 @@ supports the following options:
.Fl "b key"
specify bookmark key to open
.Pp
.Fl d
show hidden files
.Pp
.Fl e
use exiftool instead of mediainfo
.Pp
@ -244,10 +248,6 @@ with a '^' (caret) symbol.
.Pp
There is a program option to filter entries by substring match instead of regex.
.Pp
If
.Nm
is invoked as root or the environment variable \fBNNN_SHOW_HIDDEN\fR is set the default filter will also match hidden files.
.Pp
In the \fInavigate-as-you-type\fR mode directories are opened in filter mode,
allowing continuous navigation. Works best with the \fBarrow keys\fR.
.br
@ -328,11 +328,6 @@ files.
export NNN_USE_EDITOR=1
.Ed
.Pp
\fBNNN_SHOW_HIDDEN:\fR show hidden files.
.Bd -literal
export NNN_SHOW_HIDDEN=1
.Ed
.Pp
\fBNNN_NO_AUTOSELECT:\fR disable directory auto-selection in \fInavigate-as-you-type\fR mode.
.Bd -literal
export NNN_NO_AUTOSELECT=1

View file

@ -454,13 +454,12 @@ static const char * const messages[] = {
#define NNN_TMPFILE 7
#define NNNLVL 8 /* strings end here */
#define NNN_USE_EDITOR 9 /* flags begin here */
#define NNN_SHOW_HIDDEN 10
#define NNN_NO_AUTOSELECT 11
#define NNN_RESTRICT_NAV_OPEN 12
#define NNN_RESTRICT_0B 13
#define NNN_TRASH 14
#define NNN_NO_AUTOSELECT 10
#define NNN_RESTRICT_NAV_OPEN 11
#define NNN_RESTRICT_0B 12
#define NNN_TRASH 13
#ifdef __linux__
#define NNN_OPS_PROG 15
#define NNN_OPS_PROG 14
#endif
static const char * const env_cfg[] = {
@ -474,7 +473,6 @@ static const char * const env_cfg[] = {
"NNN_TMPFILE",
"NNNLVL",
"NNN_USE_EDITOR",
"NNN_SHOW_HIDDEN",
"NNN_NO_AUTOSELECT",
"NNN_RESTRICT_NAV_OPEN",
"NNN_RESTRICT_0B",
@ -3967,13 +3965,14 @@ nochange:
static void usage(void)
{
fprintf(stdout,
"%s: nnn [-b key] [-C] [-e] [-i] [-l] [-n]\n"
"%s: nnn [-b key] [-C] [-d] [-e] [-i] [-l] [-n]\n"
" [-p file] [-s] [-S] [-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"
"optional args:\n"
" -b key open bookmark key\n"
" -d show hidden files\n"
" -C disable directory color\n"
" -e use exiftool for media info\n"
" -i nav-as-you-type mode\n"
@ -3994,7 +3993,7 @@ int main(int argc, char *argv[])
char *ipath = NULL;
int opt;
while ((opt = getopt(argc, argv, "Slib:enp:svwh")) != -1) {
while ((opt = getopt(argc, argv, "Slib:denp:svwh")) != -1) {
switch (opt) {
case 'S':
cfg.blkorder = 1;
@ -4011,6 +4010,9 @@ int main(int argc, char *argv[])
case 'b':
ipath = optarg;
break;
case 'd':
cfg.showhidden = 1;
break;
case 'e':
cfg.metaviewer = EXIFTOOL;
break;
@ -4102,9 +4104,6 @@ int main(int argc, char *argv[])
/* Increase current open file descriptor limit */
open_max = max_openfds();
if (getuid() == 0 || getenv(env_cfg[NNN_SHOW_HIDDEN]))
cfg.showhidden = 1;
/* Edit text in EDITOR, if opted */
if (getenv(env_cfg[NNN_USE_EDITOR]))
cfg.useeditor = 1;