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

[PATCH] initialization of main keymap



On Wed, Aug 31, 2022 at 6:22 PM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> This is silly! Just because my login name contains "vi"
> on some machines, I get the vi bindings.

How about this?
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index d90838f03..8e5ad3fa2 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1454,8 +1454,8 @@ 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")) && strstr(ed, "vi") > rindex(ed, '/')) ||
+	((ed = zgetenv("EDITOR")) && strstr(ed, "vi") > rindex(ed, '/')))
 	linkkeymap(vmap, "main", 0);
     else
 	linkkeymap(emap, "main", 0);



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