about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_keymap.c10
-rw-r--r--Src/Zle/zle_main.c2
-rw-r--r--Src/init.c3
-rw-r--r--Src/zsh.h2
4 files changed, 17 insertions, 0 deletions
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index c36657697..3a06bb632 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1370,3 +1370,13 @@ getkeycmd(void)
 	func = lastnamed;
     return func;
 }
+
+/**/
+mod_export void
+zlesetkeymap(int mode)
+{
+    Keymap km = openkeymap((mode == VIMODE) ? "viins" : "emacs");
+    if (!km)
+	return;
+    linkkeymap(km, "main", 0);
+}
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a8c97ba1b..1f2f07a09 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1363,6 +1363,7 @@ setup_(Module m)
     refreshptr = zrefresh;
     spaceinlineptr = spaceinline;
     zlereadptr = zleread;
+    zlesetkeymapptr = zlesetkeymap;
 
     getkeyptr = getkey;
 
@@ -1446,6 +1447,7 @@ finish_(Module m)
     refreshptr = noop_function;
     spaceinlineptr = noop_function_int;
     zlereadptr = fallback_zleread;
+    zlesetkeymapptr= noop_function_int;
 
     getkeyptr = NULL;
 
diff --git a/Src/init.c b/Src/init.c
index e3a6bda3a..06558e918 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1112,6 +1112,8 @@ mod_export ZleVoidFn refreshptr = noop_function;
 mod_export ZleVoidIntFn spaceinlineptr = noop_function_int;
 /**/
 mod_export ZleReadFn zlereadptr = autoload_zleread;
+/**/
+mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
 
 #else /* !LINKED_XMOD_zshQszle */
 
@@ -1124,6 +1126,7 @@ mod_export ZleReadFn zlereadptr = autoload_zleread;
 mod_export ZleReadFn zlereadptr = fallback_zleread;
 # endif /* !UNLINKED_XMOD_zshQszle */
 
+mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
 #endif /* !LINKED_XMOD_zshQszle */
 
 /**/
diff --git a/Src/zsh.h b/Src/zsh.h
index 033005dfc..1733ce9bc 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1418,6 +1418,7 @@ enum {
     CSHJUNKIEQUOTES,
     CSHNULLCMD,
     CSHNULLGLOB,
+    EMACSMODE,
     EQUALS,
     ERREXIT,
     ERRRETURN,
@@ -1515,6 +1516,7 @@ enum {
     TYPESETSILENT,
     UNSET,
     VERBOSE,
+    VIMODE,
     XTRACE,
     USEZLE,
     DVORAK,