Allow also the cursor keys for keybindings.
authorDaniel Carl <danielcarl@gmx.de>
Tue, 26 Mar 2013 23:43:46 +0000 (00:43 +0100)
committerDaniel Carl <danielcarl@gmx.de>
Tue, 26 Mar 2013 23:43:46 +0000 (00:43 +0100)
Added keybindings to step through the command an search history via cursor up
and down keys.

doc/vimb.1.txt
src/config.h
src/keybind.c

index 3442804..cb5cb7b 100644 (file)
@@ -166,7 +166,7 @@ keysequence to a command, use this format "nmap {[modkey]key}={command}[ params]
 
 The modkey is a single simple char like "g". The key can also contain
 special keys and modifiers and is given in format like "<ctrl-o>", "<tab>",
-"<shift-tab>" or also a simple char like "G".
+"<shift-tab>", "<up>", "<right>" or also a simple char like "G".
 
 Example:
 .br
index 2242721..55f8869 100644 (file)
@@ -89,7 +89,9 @@ const struct {
     {"cmap <tab>=complete"},
     {"cmap <shift-tab>=complete-back"},
     {"cmap <ctrl-p>=hist-prev"},
+    {"cmap <up>=hist-prev"},
     {"cmap <ctrl-n>=hist-next"},
+    {"cmap <down>=hist-next"},
     {"hmap <tab>=hint-focus-next"},
     {"hmap <shift-tab>=hint-focus-prev"},
     {"searchengine-add dl=https://duckduckgo.com/lite/?q=%s"},
index b48e1d3..f9b941e 100644 (file)
@@ -218,8 +218,16 @@ static guint keybind_str_to_modmask(const char* str)
 
 static guint keybind_str_to_value(const char* str)
 {
-    if (g_ascii_strcasecmp(str, "tab") == 0) {
+    if (!strcmp(str, "tab")) {
         return GDK_Tab;
+    } else if (!strcmp(str, "up")) {
+        return GDK_Up;
+    } else if (!strcmp(str, "down")) {
+        return GDK_Down;
+    } else if (!strcmp(str, "left")) {
+        return GDK_Left;
+    } else if (!strcmp(str, "right")) {
+        return GDK_Right;
     }
 
     return str[0];