* [PATCH] Initialization of main keymap [redux]
@ 2022-10-23 4:03 Bart Schaefer
2023-10-07 18:25 ` Mikael Magnusson
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2022-10-23 4:03 UTC (permalink / raw)
To: Zsh hackers list
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
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.
[-- Attachment #2: initmainkeymapbetter.txt --]
[-- Type: text/plain, Size: 628 bytes --]
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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Initialization of main keymap [redux]
2022-10-23 4:03 [PATCH] Initialization of main keymap [redux] Bart Schaefer
@ 2023-10-07 18:25 ` Mikael Magnusson
2023-10-07 20:02 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2023-10-07 18:25 UTC (permalink / raw)
To: Bart Schaefer; +Cc: Zsh hackers list
On 10/23/22, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 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.
I noticed we still haven't picked one of these. I would personally
prefer the patch that removes the check (Daniel's), but either is fine
with me. Have we heard from anyone who depends on it selecting vi
bindings for them?
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-07 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-23 4:03 [PATCH] Initialization of main keymap [redux] Bart Schaefer
2023-10-07 18:25 ` Mikael Magnusson
2023-10-07 20:02 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).