Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Initialization of main keymap [redux]
- X-seq: zsh-workers 50808
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Initialization of main keymap [redux]
- Date: Sat, 22 Oct 2022 21:03:35 -0700
- Archived-at: <https://zsh.org/workers/50808>
- List-id: <zsh-workers.zsh.org>
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