From 30d670f2e204ee8e6912a102707c102562c31021 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 28 Apr 2018 00:35:34 +0200 Subject: [PATCH] Allow basic motion commands for hinting too. --- doc/vimb.1 | 29 +++++++++++++++++++++++++++++ src/ascii.h | 1 + src/hints.c | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/doc/vimb.1 b/doc/vimb.1 index cdcfd85..7504fab 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -297,6 +297,35 @@ remain visible so that another one can be selected with the same action as the first. Note that the extended hint mode can only be combined with the following hint modes \fII o p P s t y Y\fP. +.PD +.TP +.B Motion +.RS +Motions commands are like those for normal mode except that CTRL is used as +modifier. +But they can not be used together with a count. +.PP +.PD 0 +.TP +.B CTRL-F +Scroll one page down. +.TP +.B CTRL-B +Scroll one page up. +.TP +.B CTRL-D +Scroll half page down. +.TP +.B CTRL-U +Scroll half page up. +.TP +.B CTRL-J +Scroll one step down. +.TP +.B CTRL-K +Scroll one step up. +.PD +.RE .SS Searching .TP .BI / QUERY ", ?" QUERY diff --git a/src/ascii.h b/src/ascii.h index cd47876..92906c7 100644 --- a/src/ascii.h +++ b/src/ascii.h @@ -78,6 +78,7 @@ static const unsigned char chartable[256] = { /* get internal representation for conrol character ^C */ #define CTRL(c) ((c) ^ 0x40) +#define UNCTRL(c) (((c) ^ 0x40) + 'a' - 'A') #define IS_SPECIAL(c) (c < 0) diff --git a/src/hints.c b/src/hints.c index 8905ec3..c5be1d8 100644 --- a/src/hints.c +++ b/src/hints.c @@ -29,6 +29,7 @@ #include "command.h" #include "input.h" #include "map.h" +#include "normal.h" #include "ext-proxy.h" static struct { @@ -74,6 +75,10 @@ VbResult hints_keypress(Client *c, int key) hints_focus_next(c, TRUE); return RESULT_COMPLETE; + } else if (key == CTRL('D') || key == CTRL('F') || key == CTRL('B') || key == CTRL('U')) { + return normal_keypress(c, key); + } else if (key == CTRL('J') || key == CTRL('K')) { + return normal_keypress(c, UNCTRL(key)); } else { fire_timeout(c, TRUE); /* try to handle the key by the javascript */ -- 2.20.1