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