configure: probe for size optimizing flags (disabled for now)
[vis.git] / config.def.h
blob27fc4eb49587cb2308102a864136367e8bb204fe
1 /* Configure your desired default key bindings. */
3 #define ALIAS(name) .alias = name,
4 #define ACTION(id) .action = &vis_action[VIS_ACTION_##id],
6 static const char *keymaps[] = {
7 NULL
8 };
10 static const KeyBinding bindings_basic[] = {
11 { "<C-z>", ACTION(EDITOR_SUSPEND) },
12 { "<Left>", ACTION(CURSOR_CHAR_PREV) },
13 { "<S-Left>", ACTION(CURSOR_LONGWORD_START_PREV) },
14 { "<Right>", ACTION(CURSOR_CHAR_NEXT) },
15 { "<S-Right>", ACTION(CURSOR_LONGWORD_START_NEXT) },
16 { "<Up>", ACTION(CURSOR_LINE_UP) },
17 { "<Down>", ACTION(CURSOR_LINE_DOWN) },
18 { "<PageUp>", ACTION(WINDOW_PAGE_UP) },
19 { "<PageDown>", ACTION(WINDOW_PAGE_DOWN) },
20 { "<S-PageUp>", ACTION(WINDOW_HALFPAGE_UP) },
21 { "<S-PageDown>", ACTION(WINDOW_HALFPAGE_DOWN) },
22 { "<Home>", ACTION(CURSOR_LINE_BEGIN) },
23 { "<End>", ACTION(CURSOR_LINE_END) },
24 { 0 /* empty last element, array terminator */ },
27 static const KeyBinding bindings_motions[] = {
28 { "h", ACTION(CURSOR_CHAR_PREV) },
29 { "<Backspace>", ALIAS("h") },
30 { "<C-h>", ALIAS("<Backspace>") },
31 { "l", ACTION(CURSOR_CHAR_NEXT) },
32 { " ", ALIAS("l") },
33 { "k", ACTION(CURSOR_LINE_UP) },
34 { "<C-p>", ALIAS("k") },
35 { "j", ACTION(CURSOR_LINE_DOWN) },
36 { "<C-j>", ALIAS("j") },
37 { "<C-n>", ALIAS("j") },
38 { "<Enter>", ALIAS("j") },
39 { "gk", ACTION(CURSOR_SCREEN_LINE_UP) },
40 { "g<Up>", ALIAS("gk") },
41 { "gj", ACTION(CURSOR_SCREEN_LINE_DOWN) },
42 { "g<Down>", ALIAS("gj") },
43 { "^", ACTION(CURSOR_LINE_START) },
44 { "g_", ACTION(CURSOR_LINE_FINISH) },
45 { "$", ACTION(CURSOR_LINE_LASTCHAR) },
46 { "+", ALIAS("j^") },
47 { "-", ALIAS("k^") },
48 { "%", ACTION(CURSOR_PERCENT) },
49 { "b", ACTION(CURSOR_WORD_START_PREV) },
50 { "B", ACTION(CURSOR_LONGWORD_START_PREV) },
51 { "w", ACTION(CURSOR_WORD_START_NEXT) },
52 { "W", ACTION(CURSOR_LONGWORD_START_NEXT) },
53 { "ge", ACTION(CURSOR_WORD_END_PREV) },
54 { "gE", ACTION(CURSOR_LONGWORD_END_PREV) },
55 { "e", ACTION(CURSOR_WORD_END_NEXT) },
56 { "E", ACTION(CURSOR_LONGWORD_END_NEXT) },
57 { "{", ACTION(CURSOR_PARAGRAPH_PREV) },
58 { "}", ACTION(CURSOR_PARAGRAPH_NEXT) },
59 { "(", ACTION(CURSOR_SENTENCE_PREV) },
60 { ")", ACTION(CURSOR_SENTENCE_NEXT) },
61 { "[[", ACTION(CURSOR_FUNCTION_START_PREV) },
62 { "[]", ACTION(CURSOR_FUNCTION_END_PREV) },
63 { "][", ACTION(CURSOR_FUNCTION_START_NEXT) },
64 { "]]", ACTION(CURSOR_FUNCTION_END_NEXT) },
65 { "gg", ACTION(CURSOR_LINE_FIRST) },
66 { "g0", ACTION(CURSOR_SCREEN_LINE_BEGIN) },
67 { "gm", ACTION(CURSOR_SCREEN_LINE_MIDDLE) },
68 { "g$", ACTION(CURSOR_SCREEN_LINE_END) },
69 { "G", ACTION(CURSOR_LINE_LAST) },
70 { "|", ACTION(CURSOR_COLUMN) },
71 { "n", ACTION(CURSOR_SEARCH_NEXT) },
72 { "N", ACTION(CURSOR_SEARCH_PREV) },
73 { "H", ACTION(CURSOR_WINDOW_LINE_TOP) },
74 { "M", ACTION(CURSOR_WINDOW_LINE_MIDDLE) },
75 { "L", ACTION(CURSOR_WINDOW_LINE_BOTTOM) },
76 { "*", ACTION(CURSOR_SEARCH_WORD_FORWARD) },
77 { "#", ACTION(CURSOR_SEARCH_WORD_BACKWARD) },
78 { "f", ACTION(TO_RIGHT) },
79 { "F", ACTION(TO_LEFT) },
80 { "t", ACTION(TILL_RIGHT) },
81 { "T", ACTION(TILL_LEFT) },
82 { ";", ACTION(TOTILL_REPEAT) },
83 { ",", ACTION(TOTILL_REVERSE) },
84 { "/", ACTION(PROMPT_SEARCH_FORWARD) },
85 { "?", ACTION(PROMPT_SEARCH_BACKWARD) },
86 { "`", ACTION(MARK_GOTO) },
87 { "'", ACTION(MARK_GOTO_LINE) },
88 { 0 /* empty last element, array terminator */ },
91 static const KeyBinding bindings_textobjects[] = {
92 { "aw", ACTION(TEXT_OBJECT_WORD_OUTER) },
93 { "aW", ACTION(TEXT_OBJECT_LONGWORD_OUTER) },
94 { "as", ACTION(TEXT_OBJECT_SENTENCE) },
95 { "ap", ACTION(TEXT_OBJECT_PARAGRAPH) },
96 { "a[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_OUTER) },
97 { "a]", ALIAS("a[") },
98 { "a(", ACTION(TEXT_OBJECT_PARANTHESE_OUTER) },
99 { "a)", ALIAS("a(") },
100 { "ab", ALIAS("a(") },
101 { "a<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_OUTER) },
102 { "a>", ALIAS("a<") },
103 { "a{", ACTION(TEXT_OBJECT_CURLY_BRACKET_OUTER) },
104 { "a}", ALIAS("a{") },
105 { "aB", ALIAS("a{") },
106 { "a\"", ACTION(TEXT_OBJECT_QUOTE_OUTER) },
107 { "a\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_OUTER) },
108 { "a`", ACTION(TEXT_OBJECT_BACKTICK_OUTER) },
109 { "ae", ACTION(TEXT_OBJECT_ENTIRE_OUTER) },
110 { "af", ACTION(TEXT_OBJECT_FUNCTION_OUTER) },
111 { "al", ACTION(TEXT_OBJECT_LINE_OUTER) },
112 { "iw", ACTION(TEXT_OBJECT_WORD_INNER) },
113 { "iW", ACTION(TEXT_OBJECT_LONGWORD_INNER) },
114 { "is", ACTION(TEXT_OBJECT_SENTENCE) },
115 { "ip", ACTION(TEXT_OBJECT_PARAGRAPH) },
116 { "i[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_INNER) },
117 { "i]", ALIAS("i[") },
118 { "i(", ACTION(TEXT_OBJECT_PARANTHESE_INNER) },
119 { "i)", ALIAS("i(") },
120 { "ib", ALIAS("i(") },
121 { "i<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_INNER) },
122 { "i>", ALIAS("i<") },
123 { "i{", ACTION(TEXT_OBJECT_CURLY_BRACKET_INNER) },
124 { "i}", ALIAS("i{") },
125 { "iB", ALIAS("i{") },
126 { "i\"", ACTION(TEXT_OBJECT_QUOTE_INNER) },
127 { "i\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_INNER) },
128 { "i`", ACTION(TEXT_OBJECT_BACKTICK_INNER) },
129 { "ie", ACTION(TEXT_OBJECT_ENTIRE_INNER) },
130 { "if", ACTION(TEXT_OBJECT_FUNCTION_INNER) },
131 { "il", ACTION(TEXT_OBJECT_LINE_INNER) },
132 { "i<Tab>", ACTION(TEXT_OBJECT_INDENTATION) },
133 { "a<Tab>", ACTION(TEXT_OBJECT_INDENTATION) },
134 { "gn", ACTION(TEXT_OBJECT_SEARCH_FORWARD) },
135 { "gN", ACTION(TEXT_OBJECT_SEARCH_BACKWARD) },
136 { 0 /* empty last element, array terminator */ },
139 static const KeyBinding bindings_operators[] = {
140 { "0", ACTION(COUNT) },
141 { "1", ACTION(COUNT) },
142 { "2", ACTION(COUNT) },
143 { "3", ACTION(COUNT) },
144 { "4", ACTION(COUNT) },
145 { "5", ACTION(COUNT) },
146 { "6", ACTION(COUNT) },
147 { "7", ACTION(COUNT) },
148 { "8", ACTION(COUNT) },
149 { "9", ACTION(COUNT) },
150 { "d", ACTION(OPERATOR_DELETE) },
151 { "c", ACTION(OPERATOR_CHANGE) },
152 { "y", ACTION(OPERATOR_YANK) },
153 { ">", ACTION(OPERATOR_SHIFT_RIGHT) },
154 { "<", ACTION(OPERATOR_SHIFT_LEFT) },
155 { "gU", ACTION(OPERATOR_CASE_UPPER) },
156 { "~", ACTION(OPERATOR_CASE_SWAP) },
157 { "g~", ACTION(OPERATOR_CASE_SWAP) },
158 { "gu", ACTION(OPERATOR_CASE_LOWER) },
159 { "!", ACTION(OPERATOR_FILTER) },
160 { "=", ACTION(OPERATOR_FILTER_FMT) },
161 { "p", ACTION(PUT_AFTER) },
162 { "P", ACTION(PUT_BEFORE) },
163 { "gp", ACTION(PUT_AFTER_END) },
164 { "gP", ACTION(PUT_BEFORE_END) },
165 { "\"", ACTION(REGISTER) },
166 { 0 /* empty last element, array terminator */ },
169 static const KeyBinding bindings_operator_options[] = {
170 { "v", ACTION(MOTION_CHARWISE) },
171 { "V", ACTION(MOTION_LINEWISE) },
172 { 0 /* empty last element, array terminator */ },
175 static const KeyBinding bindings_normal[] = {
176 { "<Escape>", ACTION(CURSORS_REMOVE_ALL) },
177 { "<C-c>", ALIAS("<Escape>") },
178 { "<Delete>", ALIAS("x") },
179 { "<C-k>", ACTION(CURSORS_NEW_LINE_ABOVE) },
180 { "<C-j>", ACTION(CURSORS_NEW_LINE_BELOW) },
181 { "<Tab>", ACTION(CURSORS_ALIGN) },
182 { "<C-n>", ACTION(CURSOR_SELECT_WORD) },
183 { "<C-p>", ACTION(CURSORS_REMOVE_LAST) },
184 { "<C-w>n", ALIAS(":open<Enter>") },
185 { "<C-w>c", ALIAS(":q<Enter>") },
186 { "<C-w>s", ALIAS(":split<Enter>") },
187 { "<C-w>v", ALIAS(":vsplit<Enter>") },
188 { "<C-w>j", ACTION(WINDOW_NEXT) },
189 { "<C-w>l", ALIAS("<C-w>j") },
190 { "<C-w>w", ALIAS("<C-w>j") },
191 { "<C-w><C-w>", ALIAS("<C-w>j") },
192 { "<C-w><C-j>", ALIAS("<C-w>j") },
193 { "<C-w><C-l>", ALIAS("<C-w>j") },
194 { "<C-w>k", ACTION(WINDOW_PREV) },
195 { "<C-w>h", ALIAS("<C-w>k") },
196 { "<C-w><C-h>", ALIAS("<C-w>k") },
197 { "<C-w><C-k>", ALIAS("<C-w>k") },
198 { "<C-w><Backspace>", ALIAS("<C-w>k") },
199 { "<C-b>", ALIAS("<PageUp>") },
200 { "<C-f>", ALIAS("<PageDown>") },
201 { "<C-u>", ACTION(CURSORS_PREV) },
202 { "<C-d>", ACTION(CURSORS_NEXT) },
203 { "<C-e>", ACTION(WINDOW_SLIDE_UP) },
204 { "<C-y>", ACTION(WINDOW_SLIDE_DOWN) },
205 { "<C-o>", ACTION(JUMPLIST_PREV) },
206 { "<C-i>", ACTION(JUMPLIST_NEXT) },
207 { "g;", ACTION(CHANGELIST_PREV) },
208 { "g,", ACTION(CHANGELIST_NEXT) },
209 { "a", ACTION(APPEND_CHAR_NEXT) },
210 { "A", ACTION(APPEND_LINE_END) },
211 { "C", ALIAS("c$") },
212 { "D", ALIAS("d$") },
213 { "I", ACTION(INSERT_LINE_START) },
214 { ".", ACTION(REPEAT) },
215 { "o", ACTION(OPEN_LINE_BELOW) },
216 { "O", ACTION(OPEN_LINE_ABOVE) },
217 { "J", ACTION(JOIN_LINE_BELOW) },
218 { "x", ACTION(DELETE_CHAR_NEXT) },
219 { "r", ACTION(REPLACE_CHAR) },
220 { "i", ACTION(MODE_INSERT) },
221 { "v", ACTION(MODE_VISUAL) },
222 { "V", ACTION(MODE_VISUAL_LINE) },
223 { "R", ACTION(MODE_REPLACE) },
224 { "S", ALIAS("^c$") },
225 { "s", ALIAS("cl") },
226 { "Y", ALIAS("y$") },
227 { "X", ALIAS("dh") },
228 { "u", ACTION(UNDO) },
229 { "<C-r>", ACTION(REDO) },
230 { "g+", ACTION(LATER) },
231 { "g-", ACTION(EARLIER) },
232 { "<C-l>", ACTION(REDRAW) },
233 { ":", ACTION(PROMPT_SHOW) },
234 { "ZZ", ALIAS(":wq<Enter>") },
235 { "ZQ", ALIAS(":q!<Enter>") },
236 { "zt", ACTION(WINDOW_REDRAW_TOP) },
237 { "zz", ACTION(WINDOW_REDRAW_CENTER) },
238 { "zb", ACTION(WINDOW_REDRAW_BOTTOM) },
239 { "q", ACTION(MACRO_RECORD) },
240 { "@", ACTION(MACRO_REPLAY) },
241 { "gv", ACTION(SELECTION_RESTORE) },
242 { "m", ACTION(MARK_SET) },
243 { "<F1>", ALIAS(":help<Enter>") },
244 { "ga", ACTION(UNICODE_INFO) },
245 { "~", ALIAS("<vis-operator-case-swap>ll") },
246 { "<End>", ALIAS("$") },
247 { "gf", ACTION(OPEN_FILE_UNDER_CURSOR) },
248 { "<C-w>gf", ACTION(OPEN_FILE_UNDER_CURSOR_NEW_WINDOW) },
249 { "gn", ALIAS("vgn") },
250 { "gN", ALIAS("vgN") },
251 { "<C-a>", ACTION(NUMBER_INCREMENT) },
252 { "<C-x>", ACTION(NUMBER_DECREMENT) },
253 { 0 /* empty last element, array terminator */ },
256 static const KeyBinding bindings_visual[] = {
257 { "<C-n>", ACTION(CURSORS_NEW_MATCH_NEXT) },
258 { "<C-x>", ACTION(CURSORS_NEW_MATCH_SKIP) },
259 { "<C-p>", ACTION(CURSORS_REMOVE_LAST) },
260 { "I", ACTION(CURSORS_NEW_LINES_BEGIN) },
261 { "A", ACTION(CURSORS_NEW_LINES_END) },
262 { "<Backspace>", ALIAS("d") },
263 { "<C-h>", ALIAS("<Backspace>") },
264 { "<Delete>", ALIAS("<Backspace>") },
265 { "<Escape>", ACTION(MODE_NORMAL) },
266 { "<C-c>", ALIAS("<Escape>") },
267 { "v", ALIAS("<Escape>") },
268 { "V", ACTION(MODE_VISUAL_LINE) },
269 { ":", ACTION(PROMPT_SHOW_VISUAL) },
270 { "<C-b>", ALIAS("<PageUp>") },
271 { "<C-f>", ALIAS("<PageDown>") },
272 { "<C-u>", ACTION(CURSORS_PREV) },
273 { "<C-d>", ACTION(CURSORS_NEXT) },
274 { "x", ALIAS("d") },
275 { "r", ALIAS("c") },
276 { "s", ALIAS("c") },
277 { "J", ACTION(JOIN_LINES) },
278 { "o", ACTION(SELECTION_FLIP) },
279 { ">", ALIAS("<vis-operator-shift-right>gv") },
280 { "<", ALIAS("<vis-operator-shift-left>gv") },
281 { 0 /* empty last element, array terminator */ },
284 static const KeyBinding bindings_visual_line[] = {
285 { "v", ACTION(MODE_VISUAL) },
286 { "V", ACTION(MODE_NORMAL) },
287 { 0 /* empty last element, array terminator */ },
290 static const KeyBinding bindings_readline[] = {
291 { "<Backspace>", ACTION(DELETE_CHAR_PREV) },
292 { "<C-h>", ALIAS("<Backspace>") },
293 { "<Delete>", ACTION(DELETE_CHAR_NEXT) },
294 { "<Escape>", ACTION(MODE_NORMAL) },
295 { "<C-c>", ALIAS("<Escape>") },
296 { "<C-d>", ACTION(DELETE_CHAR_NEXT) },
297 { "<C-w>", ACTION(DELETE_WORD_PREV) },
298 { "<C-u>", ACTION(DELETE_LINE_BEGIN) },
299 { "<C-v>", ACTION(INSERT_VERBATIM) },
300 { 0 /* empty last element, array terminator */ },
303 static const KeyBinding bindings_insert[] = {
304 { "<Escape>", ACTION(MODE_NORMAL) },
305 { "<C-i>", ALIAS("<Tab>") },
306 { "<Enter>", ACTION(INSERT_NEWLINE) },
307 { "<C-j>", ALIAS("<Enter>") },
308 { "<C-m>", ALIAS("<Enter>") },
309 { "<C-o>", ACTION(MODE_OPERATOR_PENDING) },
310 { "<C-d>", ALIAS("<Escape><<i") },
311 { "<C-t>", ALIAS("<Escape>>>i") },
312 { "<C-x><C-e>", ACTION(WINDOW_SLIDE_UP) },
313 { "<C-x><C-y>", ACTION(WINDOW_SLIDE_DOWN) },
314 { "<Tab>", ACTION(INSERT_TAB) },
315 { "<S-Tab>", ACTION(CURSORS_ALIGN_INDENT) },
316 { "<C-r>", ACTION(INSERT_REGISTER) },
317 { 0 /* empty last element, array terminator */ },
320 static const KeyBinding bindings_replace[] = {
321 { 0 /* empty last element, array terminator */ },
324 /* For each mode we list a all key bindings, if a key is bound in more than
325 * one array the first definition is used and further ones are ignored. */
326 static const KeyBinding **default_bindings[] = {
327 [VIS_MODE_OPERATOR_PENDING] = (const KeyBinding*[]){
328 bindings_operator_options,
329 bindings_operators,
330 bindings_textobjects,
331 bindings_motions,
332 bindings_basic,
333 NULL,
335 [VIS_MODE_NORMAL] = (const KeyBinding*[]){
336 bindings_normal,
337 bindings_operators,
338 bindings_motions,
339 bindings_basic,
340 NULL,
342 [VIS_MODE_VISUAL] = (const KeyBinding*[]){
343 bindings_visual,
344 bindings_textobjects,
345 bindings_operators,
346 bindings_motions,
347 bindings_basic,
348 NULL,
350 [VIS_MODE_VISUAL_LINE] = (const KeyBinding*[]){
351 bindings_visual_line,
352 NULL,
354 [VIS_MODE_INSERT] = (const KeyBinding*[]){
355 bindings_insert,
356 bindings_readline,
357 bindings_basic,
358 NULL,
360 [VIS_MODE_REPLACE] = (const KeyBinding*[]){
361 bindings_replace,
362 NULL,