Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] correct: add support for colemak layout



Colemak is a modern alternative to the QWERTY and Dvorak layouts,
designed for efficient and ergonomic touch typing in English.

Signed-off-by: Nikita Romanyuk <ufh8945@xxxxxxxxx>
---
 Doc/Zsh/options.yo |  8 ++++++++
 Src/options.c      |  1 +
 Src/utils.c        | 14 ++++++++++++++
 Src/zsh.h          |  3 ++-
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 443676b..cda4b33 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1235,6 +1235,14 @@ Use the Dvorak keyboard instead of the standard qwerty keyboard as a basis
 for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
 options and the tt(spell-word) editor command.
 )
+pindex(COLEMAK)
+pindex(NO_COLEMAK)
+pindex(NOCOLEMAK)
+item(tt(COLEMAK))(
+Use the Colemak keyboard instead of the standard qwerty keyboard as a basis
+for examining spelling mistakes for the tt(CORRECT) and tt(CORRECT_ALL)
+options and the tt(spell-word) editor command.
+)
 pindex(FLOW_CONTROL)
 pindex(NO_FLOW_CONTROL)
 pindex(FLOWCONTROL)
diff --git a/Src/options.c b/Src/options.c
index a1fe918..8f9fe85 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -280,6 +280,7 @@ static struct optname optns[] = {
 {{NULL, "stdin",	      OPT_ALIAS}, /* ksh */	 SHINSTDIN},
 {{NULL, "trackall",	      OPT_ALIAS}, /* ksh */	 HASHCMDS},
 {{NULL, "dvorak",	      0},			 DVORAK},
+{{NULL, "colemak",	      0},			 COLEMAK},
 {{NULL, NULL, 0}, 0}
 };
 
diff --git a/Src/utils.c b/Src/utils.c
index 62bd3e6..b3d09d7 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -4607,10 +4607,24 @@ spdist(char *s, char *t, int thresh)
 \t\"<>PYFGCRL?+\t\
 \tAOEUIDHTNS_\n\t\
 \t:QJKXBMWVZ\n\n\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
+    const char colemakkeymap[] =
+    "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t1234567890-=\t\
+\tqwfpgjluy;[]\t\
+\tarstdhneio'\n\t\
+\tzxcvbkm,./\t\t\t\
+\n\n\n\n\n\n\n\n\n\n\n\n\n\n\
+\t!@#$%^&*()_+\t\
+\tQWFPGJLUY:{}\t\
+\tARSTDHNEIO\"\n\t\
+\tZXCVBKM<>?\n\n\t\
 \n\n\n\n\n\n\n\n\n\n\n\n\n\n";
     const char *keymap;
     if ( isset( DVORAK ) )
       keymap = dvorakkeymap;
+    else if ( isset( COLEMAK ) )
+      keymap = colemakkeymap;
     else
       keymap = qwertykeymap;
 
diff --git a/Src/zsh.h b/Src/zsh.h
index 40f9ea5..93f3c8c 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2547,7 +2547,8 @@ enum {
     XTRACE,
     USEZLE,
     DVORAK,
-    OPT_SIZE
+    OPT_SIZE,
+    COLEMAK
 };
 
 /*
-- 
2.39.2





Messages sorted by: Reverse Date, Date, Thread, Author