aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jakub Jirutka <jakub@jirutka.cz>2018-04-04 03:03:26 +0200
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-04-04 06:33:26 +0530
commita85ce3348f434b8e59ad2a413ae5832168e8044a (patch)
tree14f60a860ee96ee0e72bc309b29c2062a17dab1f
parentf09bd47f2673546879c67069f2287518e1a71bdf (diff)
downloadnnn-a85ce3348f434b8e59ad2a413ae5832168e8044a.tar.gz
Show hidden files by default when env NNN_SHOW_HIDDEN is set (#100)
-rw-r--r--README.md2
-rw-r--r--nnn.14
-rw-r--r--nnn.c5
3 files changed, 9 insertions, 2 deletions
diff --git a/README.md b/README.md
index d4704dc..9651aab 100644
--- a/README.md
+++ b/README.md
@@ -263,7 +263,7 @@ Common use cases:
- to list all matches starting with the filter expression, start the expression with a `^` (caret) symbol
- type `\.mkv` to list all MKV files
-If `nnn` is invoked as root the default filter will also match hidden files.
+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 mode
diff --git a/nnn.1 b/nnn.1
index 2ca8c0a..8bc78e0 100644
--- a/nnn.1
+++ b/nnn.1
@@ -264,6 +264,10 @@ names in the shell.
.Bd -literal
export NNN_SCRIPT=/usr/local/bin/script.sh
.Ed
+\fBNNN_SHOW_HIDDEN:\fR show hidden files.
+.Bd -literal
+ export NNN_SHOW_HIDDEN=1
+.Ed
.Sh KNOWN ISSUES
If you are using urxvt you might have to set backspacekey to DEC.
.Sh AUTHORS
diff --git a/nnn.c b/nnn.c
index c783b48..740041d 100644
--- a/nnn.c
+++ b/nnn.c
@@ -2026,6 +2026,9 @@ show_help(char *path)
if (getenv("NNN_SCRIPT"))
dprintf(fd, "NNN_SCRIPT: %s\n", getenv("NNN_SCRIPT"));
+ if (getenv("NNN_SHOW_HIDDEN"))
+ dprintf(fd, "NNN_SHOW_HIDDEN: %s\n", getenv("NNN_SHOW_HIDDEN"));
+
dprintf(fd, "\nVolume: %s of ", coolsize(get_fs_free(path)));
dprintf(fd, "%s free\n\n", coolsize(get_fs_capacity(path)));
@@ -3370,7 +3373,7 @@ main(int argc, char *argv[])
/* Increase current open file descriptor limit */
open_max = max_openfds();
- if (getuid() == 0)
+ if (getuid() == 0 || getenv("NNN_SHOW_HIDDEN"))
cfg.showhidden = 1;
initfilter(cfg.showhidden, &ifilter);