From: Daniel Carl <danielcarl@gmx.de> Date: Tue, 26 Mar 2013 23:43:46 +0000 (+0100) Subject: Allow also the cursor keys for keybindings. X-Git-Url: https://git.owens.tech/editable-focus.html/editable-focus.html/git?a=commitdiff_plain;h=9d91fddb43f28a034ac58c06081437af406506f7;p=vimb.git Allow also the cursor keys for keybindings. Added keybindings to step through the command an search history via cursor up and down keys. --- 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 "<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 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 <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"}, 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];