Overhaul build system
[vis.git] / config.def.h
blob7cd2e105d5d6d04652a53a3ea85e429cfa233fa1
1 /** configure your desired default key bindings */
2 #define ALIAS(name) .alias = name,
3 #define ACTION(id) .action = &vis_action[VIS_ACTION_##id],
5 static KeyBinding basic_movement[] = {
6 { "<C-z>", ACTION(EDITOR_SUSPEND) },
7 { "<Left>", ACTION(CURSOR_CHAR_PREV) },
8 { "<S-Left>", ACTION(CURSOR_LONGWORD_START_PREV) },
9 { "<Right>", ACTION(CURSOR_CHAR_NEXT) },
10 { "<S-Right>", ACTION(CURSOR_LONGWORD_START_NEXT) },
11 { "<Up>", ACTION(CURSOR_LINE_UP) },
12 { "<Down>", ACTION(CURSOR_LINE_DOWN) },
13 { "<PageUp>", ACTION(WINDOW_PAGE_UP) },
14 { "<PageDown>", ACTION(WINDOW_PAGE_DOWN) },
15 { "<S-PageUp>", ACTION(WINDOW_HALFPAGE_UP) },
16 { "<S-PageDown>", ACTION(WINDOW_HALFPAGE_DOWN) },
17 { "<Home>", ACTION(CURSOR_LINE_BEGIN) },
18 { "<End>", ACTION(CURSOR_LINE_END) },
19 { /* empty last element, array terminator */ },
22 static KeyBinding vis_movements[] = {
23 { "h", ACTION(CURSOR_CHAR_PREV) },
24 { "<Backspace>", ALIAS("h") },
25 { "<C-h>", ALIAS("<Backspace>") },
26 { "l", ACTION(CURSOR_CHAR_NEXT) },
27 { " ", ALIAS("l") },
28 { "k", ACTION(CURSOR_LINE_UP) },
29 { "C-p", ALIAS("k") },
30 { "j", ACTION(CURSOR_LINE_DOWN) },
31 { "<C-j>", ALIAS("j") },
32 { "<C-n>", ALIAS("j") },
33 { "<Enter>", ALIAS("j") },
34 { "gk", ACTION(CURSOR_SCREEN_LINE_UP) },
35 { "g<Up>", ALIAS("gk") },
36 { "gj", ACTION(CURSOR_SCREEN_LINE_DOWN) },
37 { "g<Down>", ALIAS("gj") },
38 { "^", ACTION(CURSOR_LINE_START) },
39 { "g_", ACTION(CURSOR_LINE_FINISH) },
40 { "$", ACTION(CURSOR_LINE_END) },
41 { "%", ACTION(CURSOR_BRACKET_MATCH) },
42 { "b", ACTION(CURSOR_WORD_START_PREV) },
43 { "B", ACTION(CURSOR_LONGWORD_START_PREV) },
44 { "w", ACTION(CURSOR_WORD_START_NEXT) },
45 { "W", ACTION(CURSOR_LONGWORD_START_NEXT) },
46 { "ge", ACTION(CURSOR_WORD_END_PREV) },
47 { "gE", ACTION(CURSOR_LONGWORD_END_PREV) },
48 { "e", ACTION(CURSOR_WORD_END_NEXT) },
49 { "E", ACTION(CURSOR_LONGWORD_END_NEXT) },
50 { "{", ACTION(CURSOR_PARAGRAPH_PREV) },
51 { "}", ACTION(CURSOR_PARAGRAPH_NEXT) },
52 { "(", ACTION(CURSOR_SENTENCE_PREV) },
53 { ")", ACTION(CURSOR_SENTENCE_NEXT) },
54 { "[[", ACTION(CURSOR_FUNCTION_START_PREV) },
55 { "[]", ACTION(CURSOR_FUNCTION_END_PREV) },
56 { "][", ACTION(CURSOR_FUNCTION_START_NEXT) },
57 { "]]", ACTION(CURSOR_FUNCTION_END_NEXT) },
58 { "gg", ACTION(CURSOR_LINE_FIRST) },
59 { "g0", ACTION(CURSOR_SCREEN_LINE_BEGIN) },
60 { "gm", ACTION(CURSOR_SCREEN_LINE_MIDDLE) },
61 { "g$", ACTION(CURSOR_SCREEN_LINE_END) },
62 { "G", ACTION(CURSOR_LINE_LAST) },
63 { "|", ACTION(CURSOR_COLUMN) },
64 { "n", ACTION(CURSOR_SEARCH_NEXT) },
65 { "N", ACTION(CURSOR_SEARCH_PREV) },
66 { "H", ACTION(CURSOR_WINDOW_LINE_TOP) },
67 { "M", ACTION(CURSOR_WINDOW_LINE_MIDDLE) },
68 { "L", ACTION(CURSOR_WINDOW_LINE_BOTTOM) },
69 { "*", ACTION(CURSOR_SEARCH_WORD_FORWARD) },
70 { "#", ACTION(CURSOR_SEARCH_WORD_BACKWARD) },
71 { "f", ACTION(TO_RIGHT) },
72 { "F", ACTION(TO_LEFT) },
73 { "t", ACTION(TILL_RIGHT) },
74 { "T", ACTION(TILL_LEFT) },
75 { ";", ACTION(TOTILL_REPEAT) },
76 { ",", ACTION(TOTILL_REVERSE) },
77 { "/", ACTION(PROMPT_SEARCH_FORWARD) },
78 { "?", ACTION(PROMPT_SEARCH_BACKWARD) },
79 { "`", ACTION(MARK_GOTO) },
80 { "'", ACTION(MARK_GOTO_LINE) },
81 { /* empty last element, array terminator */ },
84 static KeyBinding vis_textobjs[] = {
85 { "aw", ACTION(TEXT_OBJECT_WORD_OUTER) },
86 { "aW", ACTION(TEXT_OBJECT_LONGWORD_OUTER) },
87 { "as", ACTION(TEXT_OBJECT_SENTENCE) },
88 { "ap", ACTION(TEXT_OBJECT_PARAGRAPH) },
89 { "a[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_OUTER) },
90 { "a]", ALIAS("a[") },
91 { "a(", ACTION(TEXT_OBJECT_PARANTHESE_OUTER) },
92 { "a)", ALIAS("a(") },
93 { "ab", ALIAS("a(") },
94 { "a<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_OUTER) },
95 { "a>", ALIAS("a<") },
96 { "a{", ACTION(TEXT_OBJECT_CURLY_BRACKET_OUTER) },
97 { "a}", ALIAS("a{") },
98 { "aB", ALIAS("a{") },
99 { "a\"", ACTION(TEXT_OBJECT_QUOTE_OUTER) },
100 { "a\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_OUTER) },
101 { "a`", ACTION(TEXT_OBJECT_BACKTICK_OUTER) },
102 { "ae", ACTION(TEXT_OBJECT_ENTIRE_OUTER) },
103 { "af", ACTION(TEXT_OBJECT_FUNCTION_OUTER) },
104 { "al", ACTION(TEXT_OBJECT_LINE_OUTER) },
105 { "iw", ACTION(TEXT_OBJECT_WORD_INNER) },
106 { "iW", ACTION(TEXT_OBJECT_LONGWORD_INNER) },
107 { "is", ACTION(TEXT_OBJECT_SENTENCE) },
108 { "ip", ACTION(TEXT_OBJECT_PARAGRAPH) },
109 { "i[", ACTION(TEXT_OBJECT_SQUARE_BRACKET_INNER) },
110 { "i]", ALIAS("i[") },
111 { "i(", ACTION(TEXT_OBJECT_PARANTHESE_INNER) },
112 { "i)", ALIAS("i(") },
113 { "ib", ALIAS("ib") },
114 { "i<", ACTION(TEXT_OBJECT_ANGLE_BRACKET_INNER) },
115 { "i>", ALIAS("i<") },
116 { "i{", ACTION(TEXT_OBJECT_CURLY_BRACKET_INNER) },
117 { "i}", ALIAS("i{") },
118 { "iB", ALIAS("i{") },
119 { "i\"", ACTION(TEXT_OBJECT_QUOTE_INNER) },
120 { "i\'", ACTION(TEXT_OBJECT_SINGLE_QUOTE_INNER) },
121 { "i`", ACTION(TEXT_OBJECT_BACKTICK_INNER) },
122 { "ie", ACTION(TEXT_OBJECT_ENTIRE_INNER) },
123 { "if", ACTION(TEXT_OBJECT_FUNCTION_INNER) },
124 { "il", ACTION(TEXT_OBJECT_LINE_INNER) },
125 { /* empty last element, array terminator */ },
128 static KeyBinding vis_operators[] = {
129 { "0", ACTION(COUNT) },
130 { "1", ACTION(COUNT) },
131 { "2", ACTION(COUNT) },
132 { "3", ACTION(COUNT) },
133 { "4", ACTION(COUNT) },
134 { "5", ACTION(COUNT) },
135 { "6", ACTION(COUNT) },
136 { "7", ACTION(COUNT) },
137 { "8", ACTION(COUNT) },
138 { "9", ACTION(COUNT) },
139 { "d", ACTION(OPERATOR_DELETE) },
140 { "c", ACTION(OPERATOR_CHANGE) },
141 { "y", ACTION(OPERATOR_YANK) },
142 { "p", ACTION(PUT_AFTER) },
143 { "P", ACTION(PUT_BEFORE) },
144 { "gp", ACTION(PUT_AFTER_END) },
145 { "gP", ACTION(PUT_BEFORE_END) },
146 { ">", ACTION(OPERATOR_SHIFT_RIGHT) },
147 { "<", ACTION(OPERATOR_SHIFT_LEFT) },
148 { "gU", ACTION(OPERATOR_CASE_UPPER) },
149 { "~", ACTION(OPERATOR_CASE_SWAP) },
150 { "g~", ACTION(OPERATOR_CASE_SWAP) },
151 { "gu", ACTION(OPERATOR_CASE_LOWER) },
152 { "\"", ACTION(REGISTER) },
153 { /* empty last element, array terminator */ },
156 static KeyBinding vis_operator_options[] = {
157 { "v", ACTION(MOTION_CHARWISE) },
158 { "V", ACTION(MOTION_LINEWISE) },
159 { /* empty last element, array terminator */ },
162 static KeyBinding vis_mode_normal[] = {
163 { "<Escape>", ACTION(CURSORS_REMOVE_ALL) },
164 { "<Delete>", ALIAS("x") },
165 { "<C-k>", ACTION(CURSORS_NEW_LINE_ABOVE) },
166 { "<C-j>", ACTION(CURSORS_NEW_LINE_BELOW) },
167 { "<C-a>", ACTION(CURSORS_ALIGN) },
168 { "<C-n>", ACTION(CURSOR_SELECT_WORD) },
169 { "<C-p>", ACTION(CURSORS_REMOVE_LAST) },
170 { "<C-w>n", ALIAS(":open<Enter>") },
171 { "<C-w>c", ALIAS(":q<Enter>") },
172 { "<C-w>s", ALIAS(":split<Enter>") },
173 { "<C-w>v", ALIAS(":vsplit<Enter>") },
174 { "<C-w>j", ACTION(WINDOW_NEXT) },
175 { "<C-w>l", ALIAS("<C-w>j") },
176 { "<C-w><C-w>", ALIAS("<C-w>j") },
177 { "<C-w><C-j>", ALIAS("<C-w>j") },
178 { "<C-w><C-l>", ALIAS("<C-w>j") },
179 { "<C-w>k", ACTION(WINDOW_PREV) },
180 { "<C-w>h", ALIAS("<C-w>k") },
181 { "<C-w><C-h>", ALIAS("<C-w>k") },
182 { "<C-w><C-k>", ALIAS("<C-w>k") },
183 { "<C-w><Backspace>", ALIAS("<C-w>k") },
184 { "<C-b>", ALIAS("<PageUp>") },
185 { "<C-f>", ALIAS("<PageDown>") },
186 { "<C-u>", ALIAS("<S-PageUp>") },
187 { "<C-d>", ALIAS("<S-PageDown>") },
188 { "<C-e>", ACTION(WINDOW_SLIDE_UP) },
189 { "<C-y>", ACTION(WINDOW_SLIDE_DOWN) },
190 { "<C-o>", ACTION(JUMPLIST_PREV) },
191 { "<C-i>", ACTION(JUMPLIST_NEXT) },
192 { "g;", ACTION(CHANGELIST_PREV) },
193 { "g,", ACTION(CHANGELIST_NEXT) },
194 { "a", ACTION(APPEND_CHAR_NEXT) },
195 { "A", ACTION(APPEND_LINE_END) },
196 { "C", ALIAS("c$") },
197 { "D", ALIAS("d$") },
198 { "I", ACTION(INSERT_LINE_START) },
199 { ".", ACTION(REPEAT) },
200 { "o", ACTION(OPEN_LINE_BELOW) },
201 { "O", ACTION(OPEN_LINE_ABOVE) },
202 { "J", ACTION(JOIN_LINE_BELOW) },
203 { "x", ACTION(DELETE_CHAR_NEXT) },
204 { "r", ACTION(REPLACE_CHAR) },
205 { "i", ACTION(MODE_INSERT) },
206 { "v", ACTION(MODE_VISUAL) },
207 { "V", ACTION(MODE_VISUAL_LINE) },
208 { "R", ACTION(MODE_REPLACE) },
209 { "S", ALIAS("cc") },
210 { "s", ALIAS("cl") },
211 { "Y", ALIAS("yy") },
212 { "X", ALIAS("dh") },
213 { "u", ACTION(UNDO) },
214 { "<C-r>", ACTION(REDO) },
215 { "g+", ACTION(LATER) },
216 { "g-", ACTION(EARLIER) },
217 { "<C-l>", ACTION(REDRAW) },
218 { ":", ACTION(PROMPT_SHOW) },
219 { "ZZ", ALIAS(":wq<Enter>") },
220 { "ZQ", ALIAS(":q!<Enter>") },
221 { "zt", ACTION(WINDOW_REDRAW_TOP) },
222 { "zz", ACTION(WINDOW_REDRAW_CENTER) },
223 { "zb", ACTION(WINDOW_REDRAW_BOTTOM) },
224 { "q", ACTION(MACRO_RECORD) },
225 { "@", ACTION(MACRO_REPLAY) },
226 { "gv", ACTION(SELECTION_RESTORE) },
227 { "m", ACTION(MARK_SET) },
228 { /* empty last element, array terminator */ },
231 static KeyBinding vis_mode_visual[] = {
232 { "<C-n>", ACTION(CURSORS_NEW_MATCH_NEXT) },
233 { "<C-x>", ACTION(CURSORS_NEW_MATCH_SKIP) },
234 { "<C-p>", ACTION(CURSORS_REMOVE_LAST) },
235 { "I", ACTION(CURSORS_NEW_LINES_BEGIN) },
236 { "A", ACTION(CURSORS_NEW_LINES_END) },
237 { "<Backspace>", ALIAS("d") },
238 { "<C-h>", ALIAS("<Backspace>") },
239 { "<Delete>", ALIAS("<Backspace>") },
240 { "<Escape>", ACTION(MODE_NORMAL) },
241 { "<C-c>", ALIAS("<Escape>") },
242 { "v", ALIAS("<Escape>") },
243 { "V", ACTION(MODE_VISUAL_LINE) },
244 { ":", ACTION(PROMPT_SHOW_VISUAL) },
245 { "x", ALIAS("d") },
246 { "r", ALIAS("c") },
247 { "s", ALIAS("c") },
248 { "J", ACTION(JOIN_LINES) },
249 { "o", ACTION(SELECTION_FLIP) },
250 { /* empty last element, array terminator */ },
253 static KeyBinding vis_mode_visual_line[] = {
254 { "v", ACTION(MODE_VISUAL) },
255 { "V", ACTION(MODE_NORMAL) },
256 { /* empty last element, array terminator */ },
259 static KeyBinding vis_mode_readline[] = {
260 { "<Backspace>", ACTION(DELETE_CHAR_PREV) },
261 { "<C-h>", ALIAS("<Backspace>") },
262 { "<Delete>", ACTION(DELETE_CHAR_NEXT) },
263 { "<Escape>", ACTION(MODE_NORMAL) },
264 { "<C-c>", ALIAS("<Enter>") },
265 { "<C-d>", ACTION(DELETE_CHAR_NEXT) },
266 { "<C-w>", ACTION(DELETE_WORD_PREV) },
267 { "<C-u>", ACTION(DELETE_LINE_BEGIN) },
268 { /* empty last element, array terminator */ },
271 static KeyBinding vis_mode_prompt[] = {
272 { "<Backspace>", ACTION(PROMPT_BACKSPACE) },
273 { "<C-h>", ALIAS("<Backspace>") },
274 { "<Enter>", ACTION(PROMPT_ENTER) },
275 { "<C-j>", ALIAS("<Enter>") },
276 { "<Tab>", ACTION(NOP) },
277 { /* empty last element, array terminator */ },
280 static KeyBinding vis_mode_insert[] = {
281 { "<Escape>", ACTION(MODE_NORMAL) },
282 { "<C-c>", ALIAS("<Escape>") },
283 { "<C-i>", ALIAS("<Tab>") },
284 { "<Enter>", ACTION(INSERT_NEWLINE) },
285 { "<C-j>", ALIAS("<Enter>") },
286 { "<C-m>", ALIAS("<Enter>") },
287 { "<C-o>", ACTION(MODE_OPERATOR_PENDING) },
288 { "<C-v>", ACTION(INSERT_VERBATIM) },
289 { "<C-d>", ALIAS("<Escape><<i") },
290 { "<C-t>", ALIAS("<Escape>>>i") },
291 { "<C-x><C-e>", ACTION(WINDOW_SLIDE_UP) },
292 { "<C-x><C-y>", ACTION(WINDOW_SLIDE_DOWN) },
293 { "<Tab>", ACTION(INSERT_TAB) },
294 { "<C-r>", ACTION(INSERT_REGISTER) },
295 { /* empty last element, array terminator */ },
298 static KeyBinding vis_mode_replace[] = {
299 { /* empty last element, array terminator */ },