]> Sergey Matveev's repositories - nnn.git/commitdiff
Add command to toggle hide .dot files
authorsin <sin@2f30.org>
Thu, 25 Feb 2016 14:54:41 +0000 (14:54 +0000)
committersin <sin@2f30.org>
Thu, 25 Feb 2016 14:54:41 +0000 (14:54 +0000)
Patch written by Richard Hyde and taken from
https://github.com/RichardHyde/noice

config.def.h
noice.1
noice.c

index e1368dc0e184698f34edab7e12d8b5f61d10595c..640407976bc79168d7b28b985ec895626d491d4f 100644 (file)
@@ -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 666b1e04cb2a45096d51ceb82a2e2e9b1e47266f..cb5b56d40aadef8d8e855bd3fad71792c8800994 100644 (file)
--- 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 d979460649efcf213bac0285effcea6075f7043f..b3a28525e58e226dea8f20d32b7846e9a0810218 100644 (file)
--- 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 */