From 9d91fddb43f28a034ac58c06081437af406506f7 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Wed, 27 Mar 2013 00:43:46 +0100 Subject: [PATCH] Allow also the cursor keys for keybindings. Added keybindings to step through the command an search history via cursor up and down keys. --- doc/vimb.1.txt | 2 +- src/config.h | 2 ++ src/keybind.c | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/vimb.1.txt b/doc/vimb.1.txt index 3442804..cb5cb7b 100644 --- a/doc/vimb.1.txt +++ b/doc/vimb.1.txt @@ -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 "", "", -"" or also a simple char like "G". +"", "", "" or also a simple char like "G". Example: .br diff --git a/src/config.h b/src/config.h index 2242721..55f8869 100644 --- a/src/config.h +++ b/src/config.h @@ -89,7 +89,9 @@ const struct { {"cmap =complete"}, {"cmap =complete-back"}, {"cmap =hist-prev"}, + {"cmap =hist-prev"}, {"cmap =hist-next"}, + {"cmap =hist-next"}, {"hmap =hint-focus-next"}, {"hmap =hint-focus-prev"}, {"searchengine-add dl=https://duckduckgo.com/lite/?q=%s"}, diff --git a/src/keybind.c b/src/keybind.c index b48e1d3..f9b941e 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -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]; -- 2.20.1