keys_config.h - ledit - Text editor (WIP) | |
git clone git://lumidify.org/ledit.git (fast, but not encrypted) | |
git clone https://lumidify.org/ledit.git (encrypted, but very slow) | |
git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/… | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
keys_config.h (6797B) | |
--- | |
1 #ifndef _KEYS_CONFIG_H_ | |
2 #define _KEYS_CONFIG_H_ | |
3 | |
4 #include "X11/Xlib.h" | |
5 #include "X11/keysym.h" | |
6 | |
7 #include "common.h" | |
8 #include "keys.h" | |
9 | |
10 /********************************* | |
11 * Key and command configuration * | |
12 *********************************/ | |
13 | |
14 char *language_default = "English (US)"; | |
15 | |
16 /* FIXME: binary search keys */ | |
17 struct { | |
18 char *func_name; | |
19 char *text; | |
20 unsigned int mods; | |
21 KeySym keysym; | |
22 ledit_mode modes; | |
23 } basic_keys_default[] = { | |
24 {"delete-chars-backwards-multiline", NULL, 0, XK_BackSpace, INSE… | |
25 {"cursor-left", NULL, 0, XK_Left, VISUAL|INSERT|NORMAL}, | |
26 {"cursor-right", NULL, 0, XK_Right, VISUAL|INSERT|NORMAL}, | |
27 {"cursor-up", NULL, 0, XK_Up, VISUAL|INSERT|NORMAL}, | |
28 {"cursor-down", NULL, 0, XK_Down, VISUAL|INSERT|NORMAL}, | |
29 {"break-line", NULL, XK_ANY_MOD, XK_Return, INSERT}, | |
30 {"delete-chars-forwards-multiline", NULL, 0, XK_Delete, INSERT}, | |
31 {"return-to-normal", NULL, 0, XK_Escape, NORMAL|VISUAL|INSERT}, | |
32 {"enter-insert", "i", 0, 0, NORMAL|VISUAL}, | |
33 {"cursor-left", "h", 0, 0, NORMAL|VISUAL}, | |
34 {"cursor-left", "h", ControlMask, 0, NORMAL|VISUAL}, | |
35 {"cursor-right", "l", 0, 0, NORMAL|VISUAL}, | |
36 {"cursor-up", "k", 0, 0, NORMAL|VISUAL}, | |
37 {"cursor-down", "j", 0, 0, NORMAL|VISUAL}, | |
38 {"toggle-hard-line-based", "t", ControlMask, 0, NORMAL|VISUAL|IN… | |
39 {"cursor-right", NULL, 0, XK_space, NORMAL|VISUAL}, | |
40 {"cursor-down", "j", ControlMask, 0, NORMAL|VISUAL}, | |
41 {"cursor-down", "n", ControlMask, 0, NORMAL|VISUAL}, | |
42 {"cursor-up", "p", ControlMask, 0, NORMAL|VISUAL}, | |
43 {"key-0", "0", 0, 0, NORMAL|VISUAL}, | |
44 {"push-1", "1", 0, 0, NORMAL|VISUAL}, | |
45 {"push-2", "2", 0, 0, NORMAL|VISUAL}, | |
46 {"push-3", "3", 0, 0, NORMAL|VISUAL}, | |
47 {"push-4", "4", 0, 0, NORMAL|VISUAL}, | |
48 {"push-5", "5", 0, 0, NORMAL|VISUAL}, | |
49 {"push-6", "6", 0, 0, NORMAL|VISUAL}, | |
50 {"push-7", "7", 0, 0, NORMAL|VISUAL}, | |
51 {"push-8", "8", 0, 0, NORMAL|VISUAL}, | |
52 {"push-9", "9", 0, 0, NORMAL|VISUAL}, | |
53 {"delete-graphemes-forwards", "x", 0, 0, NORMAL}, | |
54 {"delete-graphemes-backwards", "X", 0, 0, NORMAL}, | |
55 {"delete", "d", 0, 0, NORMAL|VISUAL}, | |
56 {"yank", "y", 0, 0, NORMAL|VISUAL}, | |
57 {"yank-lines", "Y", 0, 0, NORMAL}, | |
58 {"change", "c", 0, 0, NORMAL|VISUAL}, | |
59 {"enter-visual", "v", 0, 0, NORMAL}, | |
60 {"switch-selection-end", "o", 0, 0, VISUAL}, | |
61 {"clipboard-copy", "c", ControlMask, 0, NORMAL|VISUAL|INSERT}, | |
62 {"clipboard-paste", "v", ControlMask, 0, VISUAL|INSERT}, | |
63 {"show-line", "g", ControlMask, 0, NORMAL|VISUAL|INSERT}, | |
64 {"enter-commandedit", ":", 0, 0, NORMAL|VISUAL}, | |
65 {"enter-searchedit-backwards", "?", 0, 0, NORMAL}, | |
66 {"enter-searchedit-forwards", "/", 0, 0, NORMAL}, | |
67 {"search-next", "n", 0, 0, NORMAL|VISUAL}, | |
68 {"search-previous", "N", 0, 0, NORMAL|VISUAL}, | |
69 {"undo", "u", 0, 0, NORMAL}, | |
70 {"redo", "U", 0, 0, NORMAL}, | |
71 {"repeat-command", ".", 0, 0, NORMAL}, /* FIXME: only allow afte… | |
72 {"undo", "z", ControlMask, 0, INSERT}, | |
73 {"redo", "y", ControlMask, 0, INSERT}, /* FIXME: this is confusi… | |
74 {"screen-up", "b", ControlMask, 0, NORMAL}, | |
75 {"screen-down", "f", ControlMask, 0, NORMAL}, | |
76 {"scroll-with-cursor-down", "e", ControlMask, 0, NORMAL}, | |
77 {"scroll-with-cursor-up", "y", ControlMask, 0, NORMAL}, | |
78 {"scroll-lines-down", "d", ControlMask, 0, NORMAL}, | |
79 {"scroll-lines-up", "u", ControlMask, 0, NORMAL}, | |
80 {"move-to-eol", "$", 0, 0, NORMAL|VISUAL}, | |
81 {"next-word", "w", 0, 0, NORMAL|VISUAL}, | |
82 {"next-word-end", "e", 0, 0, NORMAL|VISUAL}, | |
83 {"next-bigword", "W", 0, 0, NORMAL|VISUAL}, | |
84 {"next-bigword-end", "E", 0, 0, NORMAL|VISUAL}, | |
85 {"previous-word", "b", 0, 0, NORMAL|VISUAL}, | |
86 {"previous-bigword", "B", 0, 0, NORMAL|VISUAL}, | |
87 {"move-to-line", "G", 0, 0, NORMAL|VISUAL}, | |
88 {"join-lines", "J", 0, 0, NORMAL}, | |
89 {"insert-at-beginning", "I", 0, 0, NORMAL}, | |
90 {"paste-buffer", "p", 0, 0, NORMAL}, | |
91 {"paste-buffer-backwards", "P", 0, 0, NORMAL}, | |
92 {"append-after-eol", "A", 0, 0, NORMAL}, | |
93 {"append-after-cursor", "a", 0, 0, NORMAL}, | |
94 {"append-line-above", "O", 0, 0, NORMAL}, | |
95 {"append-line-below", "o", 0, 0, NORMAL}, | |
96 {"insert-mark", "m", 0, 0, NORMAL|VISUAL}, | |
97 {"jump-to-mark", "'", 0, 0, NORMAL|VISUAL}, | |
98 {"change-to-eol", "C", 0, 0, NORMAL}, | |
99 {"delete-to-eol", "D", 0, 0, NORMAL}, | |
100 {"replace", "r", 0, 0, NORMAL}, | |
101 {"cursor-to-first-non-whitespace", "^", 0, 0, NORMAL}, | |
102 {"find-next-char-forwards", "t", 0, 0, NORMAL|VISUAL}, | |
103 {"find-next-char-backwards", "T", 0, 0, NORMAL|VISUAL}, | |
104 {"find-char-forwards", "f", 0, 0, NORMAL|VISUAL}, | |
105 {"find-char-backwards", "F", 0, 0, NORMAL|VISUAL}, | |
106 {"insert-text", "", 0, 0, INSERT} | |
107 }; | |
108 | |
109 struct { | |
110 char *func_name; | |
111 char *text; | |
112 unsigned int mods; | |
113 KeySym keysym; | |
114 command_mode modes; | |
115 } command_keys_default[] = { | |
116 {"substitute-yes", "y", 0, 0, CMD_SUBSTITUTE}, | |
117 {"substitute-yes-all", "Y", 0, 0, CMD_SUBSTITUTE}, | |
118 {"substitute-no", "n", 0, 0, CMD_SUBSTITUTE}, | |
119 {"substitute-no-all", "N", 0, 0, CMD_SUBSTITUTE}, | |
120 {"edit-submit", NULL, XK_ANY_MOD, XK_Return, CMD_EDIT}, | |
121 {"edit-submit-search", NULL, XK_ANY_MOD, XK_Return, CMD_EDITSEAR… | |
122 {"edit-submit-backwards-search", NULL, XK_ANY_MOD, XK_Return, CM… | |
123 {"edit-cursor-left", NULL, 0, XK_Left, CMD_EDIT|CMD_EDITSEARCH|C… | |
124 {"edit-cursor-right", NULL, 0, XK_Right, CMD_EDIT|CMD_EDITSEARCH… | |
125 {"edit-cursor-right", NULL, 0, XK_Right, CMD_EDIT|CMD_EDITSEARCH… | |
126 {"edit-previous-command", NULL, 0, XK_Up, CMD_EDIT}, | |
127 {"edit-next-command", NULL, 0, XK_Down, CMD_EDIT}, | |
128 {"edit-previous-search", NULL, 0, XK_Up, CMD_EDITSEARCH|CMD_EDIT… | |
129 {"edit-next-search", NULL, 0, XK_Down, CMD_EDITSEARCH|CMD_EDITSE… | |
130 {"edit-backspace", NULL, 0, XK_BackSpace, CMD_EDIT|CMD_EDITSEARC… | |
131 {"edit-delete", NULL, 0, XK_Delete, CMD_EDIT|CMD_EDITSEARCH|CMD_… | |
132 {"edit-cursor-to-end", NULL, 0, XK_End, CMD_EDIT|CMD_EDITSEARCH|… | |
133 {"edit-cursor-to-beginning", NULL, 0, XK_Home, CMD_EDIT|CMD_EDIT… | |
134 {"edit-discard", NULL, 0, XK_Escape, CMD_EDIT|CMD_EDITSEARCH|CMD… | |
135 {"edit-insert-text", "", 0, 0, CMD_EDIT|CMD_EDITSEARCH|CMD_EDITS… | |
136 }; | |
137 | |
138 struct { | |
139 char *func_name; | |
140 char *text; | |
141 } commands_default[] = { | |
142 {"write-quit", "wq"}, | |
143 {"write", "w"}, | |
144 {"quit", "q"}, | |
145 {"create-view", "v"}, | |
146 {"close-view", "c"}, | |
147 {"substitute", "s"} | |
148 }; | |
149 | |
150 /***************************************** | |
151 * Key and command mapping configuration * | |
152 *****************************************/ | |
153 | |
154 struct mapping { | |
155 char *from; | |
156 char *to; | |
157 }; | |
158 | |
159 struct language_mapping { | |
160 char *lang; | |
161 struct mapping *keys; | |
162 struct mapping *cmds; | |
163 size_t keys_len; | |
164 size_t cmds_len; | |
165 }; | |
166 | |
167 struct mapping key_mapping_de[] = { | |
168 {"z", "y"}, | |
169 {"y", "z"}, | |
170 {"Z", "Y"}, | |
171 {"Y", "Z"}, | |
172 {"Ö", ":"}, | |
173 {"_", "?"}, | |
174 {"-", "/"}, | |
175 {"ä", "'"} | |
176 }; | |
177 | |
178 struct language_mapping mappings_default[] = { | |
179 {"German", key_mapping_de, NULL, LENGTH(key_mapping_de), 0} | |
180 }; | |
181 | |
182 #endif /* _KEYS_CONFIG_H_ */ |