From 435cb1b748ce1f2f5c38edc1d64f4ee2424f9b3a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 3 Mar 2025 01:24:46 +0100 Subject: 53399: don't load ZLE early to set keymap When zsh is run with -o vi / -o emacs, instead of loading ZLE to force the change, only record the option state. Then when ZLE starts, the vi option determines the default keymap. --- Src/options.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Src/options.c') diff --git a/Src/options.c b/Src/options.c index 696ab5c69..8b13f0c5d 100644 --- a/Src/options.c +++ b/Src/options.c @@ -895,8 +895,9 @@ dosetopt(int optno, int value, int force, char *new_opts) */ if (sticky && sticky->emulation) return opts[optno] ? 0 : -1; - zleentry(ZLE_CMD_SET_KEYMAP, optno); - new_opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0; + if (zle_load_state == 1) + zleentry(ZLE_CMD_SET_KEYMAP, optno); + new_opts[optno ^ EMACSMODE ^ VIMODE] = 0; } else if (optno == SUNKEYBOARDHACK) { /* for backward compatibility */ keyboardhackchar = (value ? '`' : '\0'); -- cgit v1.2.3