]> Sergey Matveev's repositories - nnn.git/commitdiff
Add keys to move to the first and last entry
authorlostd <lostd@2f30.org>
Sun, 12 Jul 2015 12:32:31 +0000 (13:32 +0100)
committerlostd <lostd@2f30.org>
Sun, 12 Jul 2015 12:32:31 +0000 (13:32 +0100)
config.def.h
noice.1
noice.c

index 9b730ba4b8a402d8c4672723f8ad9f5518eb4291..167e6481cfb12497162f98d613862722b490a7db 100644 (file)
@@ -45,6 +45,14 @@ struct key bindings[] = {
        /* Page up */
        { KEY_PPAGE,      SEL_PGUP },
        { CONTROL('U'),   SEL_PGUP },
+       /* Home */
+       { KEY_HOME,       SEL_HOME },
+       { CONTROL('A'),   SEL_HOME },
+       { '^',            SEL_HOME },
+       /* End */
+       { KEY_END,        SEL_END },
+       { CONTROL('E'),   SEL_END },
+       { '$',            SEL_END },
        /* Change dir */
        { 'c',            SEL_CD },
        /* Toggle sort by time */
diff --git a/noice.1 b/noice.1
index 0c8eea03e1f246dc1b590102f01e43ee57a6a75b..ab400d61585e35f038a37ac7e279db8ea9bdf174 100644 (file)
--- a/noice.1
+++ b/noice.1
@@ -37,6 +37,10 @@ Move to next entry.
 Scroll up half a page.
 .It Ic [Pgdown] or C-d
 Scroll down half a page.
+.It Ic [Home] or C-a or ^
+Move to the first entry.
+.It Ic [End] or C-e or $
+Move to the last entry.
 .It Ic l, [Right], [Return] or C-m
 Open file or enter directory.
 .It Ic h, [Left] or [Backspace]
diff --git a/noice.c b/noice.c
index 2c408fe10488b07f4fc0c1d0e6134c1d261aa87b..228aedfae9618de94cf8f8cdb4cfc96f143da4f2 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -54,6 +54,8 @@ enum action {
        SEL_PREV,
        SEL_PGDN,
        SEL_PGUP,
+       SEL_HOME,
+       SEL_END,
        SEL_CD,
        SEL_MTIME,
        SEL_REDRAW,
@@ -827,6 +829,12 @@ moretyping:
                        if (cur > 0)
                                cur -= MIN((LINES - 4) / 2, cur);
                        break;
+               case SEL_HOME:
+                       cur = 0;
+                       break;
+               case SEL_END:
+                       cur = n - 1;
+                       break;
                case SEL_CD:
                        /* Read target dir */
                        printprompt("chdir: ");