README.md | 4 +---
nnn.1 | 13 ++++---------
src/nnn.c | 23 +++++++++++------------
diff --git a/README.md b/README.md
index 6a4a88f759d7edb27445106368ba2bed0705f425..a2cbb6cf93fc3b83f3f7284c3360b84a9a591b55 100644
--- a/README.md
+++ b/README.md
@@ -206,6 +206,7 @@ PATH start dir [default: current dir]
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 @@ - use `.*` to match any character (_sort of_ fuzzy search)
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 @@ | `NNN_SCRIPT=/home/user/scripts[/script.sh]` | path to script dir or a single script |
| `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 ↵, not → or l |
| `NNN_RESTRICT_0B=1` | do not open 0-byte files |
diff --git a/nnn.1 b/nnn.1
index d09cc3eee42e19263f58f6c7f20c5d3148b5437c..7ea9c3d704ec059ea32ef66a33b87535a561526a 100644
--- a/nnn.1
+++ b/nnn.1
@@ -7,6 +7,7 @@ .Nd the missing terminal file manager for X
.Sh SYNOPSIS
.Nm
.Op Ar -b key
+.Op Ar -d
.Op Ar -e
.Op Ar -i
.Op Ar -l
@@ -173,6 +174,9 @@ .Pp
.Fl "b key"
specify bookmark key to open
.Pp
+.Fl d
+ show hidden files
+.Pp
.Fl e
use exiftool instead of mediainfo
.Pp
@@ -243,10 +247,6 @@ .br
(3) Use '.*' to match any character (\fIsort of\fR fuzzy search).
.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.
@@ -326,11 +326,6 @@ \fBNNN_USE_EDITOR:\fR use EDITOR (VISUAL takes preference, preferably CLI, fallback vi) to handle text
files.
.Bd -literal
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.
diff --git a/src/nnn.c b/src/nnn.c
index 1f50339e0be8559cdc88ff8dab8d54d1461b4532..0446e019a776828695cae9e1e317a8812e2a460d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -454,13 +454,12 @@ #define NNN_NOTE 6
#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 @@ "NNN_NOTE",
"NNN_TMPFILE",
"NNNLVL",
"NNN_USE_EDITOR",
- "NNN_SHOW_HIDDEN",
"NNN_NO_AUTOSELECT",
"NNN_RESTRICT_NAV_OPEN",
"NNN_RESTRICT_0B",
@@ -3967,13 +3965,14 @@
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 @@ char cwd[PATH_MAX] __attribute__ ((aligned));
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;
@@ -4010,6 +4009,9 @@ cfg.filtermode = 1;
break;
case 'b':
ipath = optarg;
+ break;
+ case 'd':
+ cfg.showhidden = 1;
break;
case 'e':
cfg.metaviewer = EXIFTOOL;
@@ -4101,9 +4103,6 @@ }
/* 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]))