summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-09-05 20:39:08 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-09-05 20:39:08 +0000
commitff955f61b4ae277fa82ff0097d47047198aeaefc (patch)
treefcdf65dd77629a20d9f9c3b14274e1277d9c1918 /Src
parent17dee17e4e5ab99cd50e6ee3a21a8d6faa4aac96 (diff)
downloadzsh-ff955f61b4ae277fa82ff0097d47047198aeaefc.tar.gz
zsh-ff955f61b4ae277fa82ff0097d47047198aeaefc.tar.xz
zsh-ff955f61b4ae277fa82ff0097d47047198aeaefc.zip
28229: can list individual keymaps
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_keymap.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 0d250c585..8fa8e9883 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -724,7 +724,7 @@ bin_bindkey(char *name, char **argv, Options ops, UNUSED(int func))
 	int (*func) _((char *, char *, Keymap, char **, Options, char));
 	int min, max;
     } const opns[] = {
-	{ 'l', 0, bin_bindkey_lsmaps, 0,  0 },
+	{ 'l', 0, bin_bindkey_lsmaps, 0,  -1 },
 	{ 'd', 0, bin_bindkey_delall, 0,  0 },
 	{ 'D', 0, bin_bindkey_del,    1, -1 },
 	{ 'A', 0, bin_bindkey_link,   2,  2 },
@@ -807,10 +807,24 @@ bin_bindkey(char *name, char **argv, Options ops, UNUSED(int func))
 
 /**/
 static int
-bin_bindkey_lsmaps(UNUSED(char *name), UNUSED(char *kmname), UNUSED(Keymap km), UNUSED(char **argv), Options ops, UNUSED(char func))
+bin_bindkey_lsmaps(char *name, UNUSED(char *kmname), UNUSED(Keymap km), char **argv, Options ops, UNUSED(char func))
 {
-    scanhashtable(keymapnamtab, 1, 0, 0, scanlistmaps, OPT_ISSET(ops,'L'));
-    return 0;
+    int ret = 0;
+    if (*argv) {
+	for (; *argv; argv++) {
+	    KeymapName kmn = (KeymapName)
+		keymapnamtab->getnode(keymapnamtab, *argv);
+	    if (!kmn) {
+		zwarnnam(name, "no such keymap: `%s'", *argv);
+		ret = 1;
+	    } else {
+		scanlistmaps((HashNode)kmn, OPT_ISSET(ops,'L'));
+	    }
+	}
+    } else {
+	scanhashtable(keymapnamtab, 1, 0, 0, scanlistmaps, OPT_ISSET(ops,'L'));
+    }
+    return ret;
 }
 
 /**/