mirror of
https://github.com/zsh-users/zsh
synced 2024-10-01 21:54:34 +00:00
28229: can list individual keymaps
This commit is contained in:
parent
17dee17e4e
commit
ff955f61b4
|
@ -1,7 +1,8 @@
|
|||
2010-09-05 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 28226: Doc/Zsh/zle.yo, Src/Zle/zle_keymap.c: "bindkey -lL" now
|
||||
lists aliased keymaps in a more useful way.
|
||||
* 28226, 28229: Doc/Zsh/zle.yo, Src/Zle/zle_keymap.c: "bindkey
|
||||
-lL" now lists aliased keymaps in a more useful way; can list
|
||||
individual keymaps.
|
||||
|
||||
* 28227: Doc/Zsh/zle.yo: a few remarks on the question of
|
||||
keymaps.
|
||||
|
@ -13599,5 +13600,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5069 $
|
||||
* $Revision: 1.5070 $
|
||||
*****************************************************
|
||||
|
|
|
@ -139,7 +139,7 @@ cindex(rebinding keys)
|
|||
cindex(keys, binding)
|
||||
cindex(binding keys)
|
||||
cindex(keymaps)
|
||||
xitem(tt(bindkey) [ var(options) ] tt(-l))
|
||||
xitem(tt(bindkey) [ var(options) ] tt(-l) [ tt(-l) ] [ var(keymap) ... ])
|
||||
xitem(tt(bindkey) [ var(options) ] tt(-d))
|
||||
xitem(tt(bindkey) [ var(options) ] tt(-D) var(keymap) ...)
|
||||
xitem(tt(bindkey) [ var(options) ] tt(-A) var(old-keymap new-keymap))
|
||||
|
@ -179,10 +179,13 @@ selected, namely:
|
|||
|
||||
startitem()
|
||||
item(tt(-l))(
|
||||
List all existing keymap names. If the tt(-L)
|
||||
option is also used, list in the form of tt(bindkey)
|
||||
commands to create the keymaps; this combination also shows
|
||||
which keymap is linked to `tt(main)', if any.
|
||||
List all existing keymap names; if any arguments are given, list just
|
||||
those keymaps.
|
||||
|
||||
If the tt(-L) option is also used, list in the form of tt(bindkey)
|
||||
commands to create or link the keymaps. `tt(bindkey -lL
|
||||
main)' shows which keymap is linked to `tt(main)', if any, and hence if
|
||||
the standard emacs or vi emulation is in effect.
|
||||
)
|
||||
item(tt(-d))(
|
||||
Delete all existing keymaps and reset to the default state.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
|
Loading…
Reference in a new issue