about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-05-14 15:09:14 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-05-14 15:09:14 +0000
commit62719196b27496c3cc4ff97a92fc03627b1bab38 (patch)
treee3d8dbd8126d1717a09272c0fcbf1125ecc4b975 /Src
parent2b744cb21d87de89495d2e66843946008c98f556 (diff)
downloadzsh-62719196b27496c3cc4ff97a92fc03627b1bab38.tar.gz
zsh-62719196b27496c3cc4ff97a92fc03627b1bab38.tar.xz
zsh-62719196b27496c3cc4ff97a92fc03627b1bab38.zip
18536: EMACS and VI compatibility options
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,