1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-07 05:52:02 +02:00

50569 (Daniel Shahaf): main keymap defaults to emacs

Tweaked to make the sample .zshrc code better match the former C code,
and to remove the declaration of no-longer-used variable "ed".
This commit is contained in:
Bart Schaefer 2023-10-26 20:55:45 -07:00
parent d86cc841f7
commit f36fccbb84
2 changed files with 5 additions and 9 deletions

View file

@ -1,5 +1,7 @@
2023-10-25 Bart Schaefer <schaefer@zsh.org> 2023-10-25 Bart Schaefer <schaefer@zsh.org>
* Daniel Shahaf: 50569 (tweaked): main keymap defaults to emacs
* Sebastian Gniazdowski: 52240: Functions/MIME/zsh-mime-handler: * Sebastian Gniazdowski: 52240: Functions/MIME/zsh-mime-handler:
use work-var $s not $suffix when setting flags use work-var $s not $suffix when setting flags

View file

@ -1315,7 +1315,7 @@ default_bindings(void)
Keymap vismap = newkeymap(NULL, "visual"); Keymap vismap = newkeymap(NULL, "visual");
Keymap smap = newkeymap(NULL, ".safe"); Keymap smap = newkeymap(NULL, ".safe");
Keymap vimaps[2], vilmaps[2], kptr; Keymap vimaps[2], vilmaps[2], kptr;
char buf[3], *ed; char buf[3];
int i; int i;
/* vi insert mode and emacs mode: * /* vi insert mode and emacs mode: *
@ -1445,20 +1445,14 @@ default_bindings(void)
} }
/* Put the keymaps in the right namespace. The "main" keymap * /* Put the keymaps in the right namespace. The "main" keymap *
* will be linked to the "emacs" keymap, except that if VISUAL * * will be linked to the "emacs" keymap. */
* or EDITOR contain the string "vi" then it will be linked to *
* the "viins" keymap. */
linkkeymap(vmap, "viins", 0); linkkeymap(vmap, "viins", 0);
linkkeymap(emap, "emacs", 0); linkkeymap(emap, "emacs", 0);
linkkeymap(amap, "vicmd", 0); linkkeymap(amap, "vicmd", 0);
linkkeymap(oppmap, "viopp", 0); linkkeymap(oppmap, "viopp", 0);
linkkeymap(vismap, "visual", 0); linkkeymap(vismap, "visual", 0);
linkkeymap(smap, ".safe", 1); linkkeymap(smap, ".safe", 1);
if (((ed = zgetenv("VISUAL")) && strstr(ed, "vi")) || linkkeymap(emap, "main", 0);
((ed = zgetenv("EDITOR")) && strstr(ed, "vi")))
linkkeymap(vmap, "main", 0);
else
linkkeymap(emap, "main", 0);
/* the .safe map cannot be modified or deleted */ /* the .safe map cannot be modified or deleted */
smap->flags |= KM_IMMUTABLE; smap->flags |= KM_IMMUTABLE;