"cunmap <shift\-tab>" To remove this keybinding use.
If a keybinding is added, for the same key-sequence like another keybinding,
-the later added have precedence. If a keybinding is removed only that with the
-highest precedence will be removed and all other will still be active.
+the previous keybinding will be removed.
.TP
.B nmap
Add a keybinding used in Normal Mode.
static GSList *keys;
static GString *modkeys;
+static void keybind_remove(Keybind *kb);
static void rebuild_modkeys(void);
static GSList *find(int mode, guint modkey, guint modmask, guint keyval);
static void string_to_keybind(char *str, Keybind *key);
string_to_keybind(keystring, keybind);
+ /* remove possible existing keybinding */
+ keybind_remove(keybind);
+
/* add the keybinding to the list */
keys = g_slist_prepend(keys, keybind);
/* fill the keybind with data from given string */
string_to_keybind(str, &keybind);
- GSList *link = find(keybind.mode, keybind.modkey, keybind.modmask, keybind.keyval);
+ keybind_remove(&keybind);
+
+ return true;
+}
+
+static void keybind_remove(Keybind *kb)
+{
+ GSList *link = find(kb->mode, kb->modkey, kb->modmask, kb->keyval);
if (link) {
free_keybind((Keybind*)link->data);
keys = g_slist_delete_link(keys, link);
+ if (kb->modkey && strchr(modkeys->str, kb->modkey)) {
+ /* remove eventually no more used modkeys */
+ rebuild_modkeys();
+ }
}
-
- if (keybind.modkey && strchr(modkeys->str, keybind.modkey) != NULL) {
- /* remove eventually no more used modkeys */
- rebuild_modkeys();
- }
- return true;
}
/**