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

[PATCH] Initialization of main keymap [redux]



Here's an update to my patch from workers/50559.  The patch herein
correctly compares only the string to the right of the rightmost "/"
and also always prefers $VISUAL to $EDITOR.

Daniel proposed alternately in workers/50569 that we discard this test
entirely and always default to the emacs keymap.  I don't feel
strongly about it but as it's currently broken for many cases of
setting those variables to a full path, we should pick one or the
other.
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index d90838f03..33804d487 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1454,8 +1454,9 @@ default_bindings(void)
     linkkeymap(oppmap, "viopp", 0);
     linkkeymap(vismap, "visual", 0);
     linkkeymap(smap, ".safe", 1);
-    if (((ed = zgetenv("VISUAL")) && strstr(ed, "vi")) ||
-	((ed = zgetenv("EDITOR")) && strstr(ed, "vi")))
+    if (((ed = zgetenv("VISUAL")) || (ed = zgetenv("EDITOR"))) &&
+	(rindex(ed, '/') > ed ?
+	 strstr(rindex(ed, '/'), "vi") : strstr(ed, "vi")))
 	linkkeymap(vmap, "main", 0);
     else
 	linkkeymap(emap, "main", 0);


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