Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: give precedence to local keymaps (was Re: More on getkeycmd())



Bart wrote:
> 
> I don't particularly object, though of course the ideal behavior would be
> that the prefix would be treated as such whenever the two maps overlap.

Well, no: I don't want to treat the key as a prefix when the global
binding is a prefix of the local binding because then I'm forced to
type the local binding faster than $KEYTIMEOUT. I use a fairly short
$KEYTIMEOUT having had problems with escape followed by vi commands
being interpreted as a key sequence.

How about the following patch? This does hiding in the case I mention
above but not for the converse: a local binding that is a prefix of a
global binding won't hide the longer global binding: you might not want
the small $KEYTIMEOUT delay but that's harmless compared to having to
type your keys faster than it.

Oliver

diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index e21e769..6a71076 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1435,7 +1435,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
 	    loc = ((f = keybind(localkeymap, keybuf, &s)) != t_undefinedkey);
 	    ispfx = keyisprefix(localkeymap, keybuf);
 	}
-	if (!loc)
+	if (!loc && !ispfx)
 	    f = keybind(km, keybuf, &s);
 	ispfx |= keyisprefix(km, keybuf);
 



Messages sorted by: Reverse Date, Date, Thread, Author