aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar sin <sin@2f30.org>2016-02-25 14:54:41 +0000
committerGravatar sin <sin@2f30.org>2016-02-25 14:54:41 +0000
commite1c26079b109a8ef074362142636c970ccdc9465 (patch)
tree3c9c1b5bc61d22d189c0e150d2afbe4c46aeb127
parentde1e3394a6700781c49f93bec6745bd8caa74d3c (diff)
downloadnnn-e1c26079b109a8ef074362142636c970ccdc9465.tar.gz
Add command to toggle hide .dot files
Patch written by Richard Hyde and taken from https://github.com/RichardHyde/noice
-rw-r--r--config.def.h2
-rw-r--r--noice.12
-rw-r--r--noice.c7
3 files changed, 11 insertions, 0 deletions
diff --git a/config.def.h b/config.def.h
index e1368dc..6404079 100644
--- a/config.def.h
+++ b/config.def.h
@@ -56,6 +56,8 @@ struct key bindings[] = {
{ '$', SEL_END },
/* Change dir */
{ 'c', SEL_CD },
+ /* Toggle hide .dot files */
+ { '.', SEL_TOGGLEDOT },
/* Toggle sort by time */
{ 't', SEL_MTIME },
{ CONTROL('L'), SEL_REDRAW },
diff --git a/noice.1 b/noice.1
index 666b1e0..cb5b56d 100644
--- a/noice.1
+++ b/noice.1
@@ -49,6 +49,8 @@ Back up one directory level.
Change filter (see below for more information).
.It Ic c
Change into the given directory.
+.It Ic \&.
+Toggle hide .dot files.
.It Ic t
Toggle sort by time modified.
.It Ic C-l
diff --git a/noice.c b/noice.c
index d979460..b3a2852 100644
--- a/noice.c
+++ b/noice.c
@@ -57,6 +57,7 @@ enum action {
SEL_HOME,
SEL_END,
SEL_CD,
+ SEL_TOGGLEDOT,
SEL_MTIME,
SEL_REDRAW,
SEL_RUN,
@@ -706,6 +707,12 @@ nochange:
strlcpy(fltr, ifilter, sizeof(fltr))
DPRINTF_S(path);
goto begin;
+ case SEL_TOGGLEDOT:
+ if (strcmp(fltr, ifilter) != 0)
+ strlcpy(fltr, ifilter, sizeof(fltr));
+ else
+ strlcpy(fltr, ".", sizeof(fltr));
+ goto begin;
case SEL_MTIME:
mtimeorder = !mtimeorder;
/* Save current */