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);