]> Sergey Matveev's repositories - nnn.git/commitdiff
Add emacs-like keybinds for next/prev entry selection
authorsin <sin@2f30.org>
Thu, 9 Oct 2014 14:54:07 +0000 (15:54 +0100)
committersin <sin@2f30.org>
Thu, 9 Oct 2014 14:54:40 +0000 (15:54 +0100)
noice.c

diff --git a/noice.c b/noice.c
index a1d488f4984b535011c0b79dbe363e8ae23781ce..b61ea0d8760b30bc0326333468699d1daa1b4ade 100644 (file)
--- a/noice.c
+++ b/noice.c
@@ -34,6 +34,7 @@
 #define LEN(x) (sizeof(x) / sizeof(*(x)))
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
 #define ISODD(x) ((x) & 1)
+#define CONTROL(c) ((c) ^ 0x40)
 
 struct assoc {
        char *regex; /* Regex to match on filename */
@@ -182,12 +183,14 @@ nextsel(int *cur, int max)
        /* next */
        case 'j':
        case KEY_DOWN:
+       case CONTROL('N'):
                if (*cur < max - 1)
                        (*cur)++;
                break;
        /* prev */
        case 'k':
        case KEY_UP:
+       case CONTROL('P'):
                if (*cur > 0)
                        (*cur)--;
                break;