Init/deinit clean up
[pantumic.git] / src / keybind-defaults.c
blobee913061460405a70253ae390e7e9a90450e4756
1 /*
2 Copyright (C) 2009 The Free Software Foundation, Inc.
4 Written by: 2005 Vitja Makarov
5 2009 Ilia Maslakov
7 This file is part of the Midnight Commander.
9 The Midnight Commander is free software; you can redistribute it
10 and/or modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version.
14 The Midnight Commander is distributed in the hope that it will be
15 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 MA 02110-1301, USA.
25 #include <config.h>
27 #include "lib/global.h"
28 #include "lib/tty/key.h"
30 #include "keybind-defaults.h"
32 /*** global variables ****************************************************************************/
34 #ifdef USE_INTERNAL_EDIT
35 GArray *editor_keymap = NULL;
36 GArray *editor_x_keymap = NULL;
38 const global_keymap_t *editor_map;
39 const global_keymap_t *editor_x_map;
40 #endif
42 GArray *main_keymap = NULL;
43 GArray *main_x_keymap = NULL;
44 GArray *viewer_keymap = NULL;
45 GArray *viewer_hex_keymap = NULL;
46 GArray *panel_keymap = NULL;
47 GArray *input_keymap = NULL;
48 GArray *listbox_keymap = NULL;
49 GArray *tree_keymap = NULL;
50 GArray *help_keymap = NULL;
51 GArray *dialog_keymap = NULL;
53 #ifdef USE_DIFF_VIEW
54 GArray *diff_keymap = NULL;
56 const global_keymap_t *diff_map;
57 #endif
59 const global_keymap_t *main_map;
60 const global_keymap_t *main_x_map;
61 const global_keymap_t *panel_map;
62 const global_keymap_t *input_map;
63 const global_keymap_t *listbox_map;
64 const global_keymap_t *tree_map;
65 const global_keymap_t *help_map;
66 const global_keymap_t *dialog_map;
68 /*** global variables ****************************************************************************/
70 /* viewer/actions_cmd.c */
71 const global_keymap_t default_viewer_keymap[] = {
72 {KEY_F (1), CK_ViewHelp, "F1"},
73 {KEY_F (2), CK_ViewToggleWrapMode, "F2"},
74 {KEY_F (3), CK_ViewQuit, "F3"},
75 {KEY_F (4), CK_ViewToggleHexMode, "F4"},
76 {KEY_F (5), CK_ViewGoto, "F5"},
77 {KEY_F (7), CK_ViewSearch, "F7"},
78 {KEY_F (8), CK_ViewToggleMagicMode, "F8"},
79 {KEY_F (9), CK_ViewToggleNroffMode, "F9"},
80 {KEY_F (10), CK_ViewQuit, "F10"},
82 {'?', CK_ViewSearch, "?"},
83 {'/', CK_ViewSearch, "/"},
84 {XCTRL ('r'), CK_ViewContinueSearch, "C-r"},
85 {XCTRL ('s'), CK_ViewContinueSearch, "C-s"},
86 {KEY_F (17), CK_ViewContinueSearch, "S-F7"},
87 {'n', CK_ViewContinueSearch, "n"},
88 {ALT ('r'), CK_ViewToggleRuler, "M-r"},
90 {XCTRL ('a'), CK_ViewMoveToBol, "C-a"},
91 {XCTRL ('e'), CK_ViewMoveToEol, "C-e"},
93 {'h', CK_ViewMoveLeft, "h"},
94 {KEY_LEFT, CK_ViewMoveLeft, "Left"},
96 {'l', CK_ViewMoveRight, "l"},
97 {KEY_RIGHT, CK_ViewMoveRight, "Right"},
99 {KEY_M_CTRL | KEY_LEFT, CK_ViewMoveLeft10, "C-Left"},
100 {KEY_M_CTRL | KEY_RIGHT, CK_ViewMoveRight10, "C-Right"},
102 {'k', CK_ViewMoveUp, "k"},
103 {'y', CK_ViewMoveUp, "y"},
104 {XCTRL ('p'), CK_ViewMoveUp, "C-p"},
105 {KEY_IC, CK_ViewMoveUp, "Insert"},
106 {KEY_UP, CK_ViewMoveUp, "Up"},
108 {'j', CK_ViewMoveDown, "j"},
109 {'e', CK_ViewMoveDown, "e"},
110 {XCTRL ('n'), CK_ViewMoveUp, "C-n"},
111 {KEY_DOWN, CK_ViewMoveDown, "Down"},
112 {KEY_DC, CK_ViewMoveDown, "Delete"},
113 {'\n', CK_ViewMoveDown, "Endter"},
115 {' ', CK_ViewMovePgDn, "Space"},
116 {'f', CK_ViewMovePgDn, "f"},
117 {KEY_NPAGE, CK_ViewMovePgDn, "PgDn"},
118 {XCTRL ('v'), CK_ViewMovePgDn, "C-v"},
120 {'b', CK_ViewMovePgUp, "b"},
121 {KEY_PPAGE, CK_ViewMovePgUp, "PgUp"},
122 {ALT ('v'), CK_ViewMovePgUp, "M-v"},
123 {KEY_BACKSPACE, CK_ViewMovePgUp, "BackSpace"},
125 {'d', CK_ViewMoveHalfPgDn, "d"},
126 {'u', CK_ViewMoveHalfPgUp, "u"},
128 {KEY_HOME, CK_ViewMoveTop, "Home"},
129 {KEY_M_CTRL | KEY_HOME, CK_ViewMoveTop, "C-Home"},
130 {KEY_M_CTRL | KEY_PPAGE, CK_ViewMoveTop, "C-PgUp"},
131 {KEY_A1, CK_ViewMoveTop, "A1"},
132 {ALT ('<'), CK_ViewMoveTop, "M-<"},
133 {'g', CK_ViewMoveTop, "g"},
135 {KEY_END, CK_ViewMoveBottom, "End"},
136 {KEY_M_CTRL | KEY_END, CK_ViewMoveBottom, "C-End"},
137 {KEY_M_CTRL | KEY_NPAGE, CK_ViewMoveBottom, "C-PgDn"},
138 {KEY_C1, CK_ViewMoveBottom, "C1"},
139 {ALT ('>'), CK_ViewMoveBottom, "M->"},
140 {'G', CK_ViewMoveBottom, "G"},
142 {'m', CK_ViewGotoBookmark, "m"},
143 {'r', CK_ViewNewBookmark, "r"},
145 {XCTRL ('f'), CK_ViewNextFile, "C-f"},
146 {XCTRL ('b'), CK_ViewPrevFile, "C-b"},
148 {'q', CK_ViewQuit, "q"},
149 {XCTRL ('g'), CK_ViewQuit, "C-g"},
150 {ESC_CHAR, CK_ViewQuit, "Esc"},
152 {ALT ('e'), CK_SelectCodepage, "M-e"},
153 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
155 {0, CK_Ignore_Key, ""}
158 const global_keymap_t default_viewer_hex_keymap[] = {
159 {KEY_F (1), CK_ViewHelp, "F1"},
160 {KEY_F (2), CK_ViewToggleHexEditMode, "F2"},
161 {KEY_F (3), CK_ViewQuit, "F3"},
162 {KEY_F (4), CK_ViewToggleHexMode, "F4"},
163 {KEY_F (5), CK_ViewGoto, "F5"},
164 {KEY_F (6), CK_ViewHexEditSave, "F6"},
165 {KEY_F (7), CK_ViewSearch, "F7"},
166 {KEY_F (8), CK_ViewToggleMagicMode, "F8"},
167 {KEY_F (9), CK_ViewToggleNroffMode, "F9"},
168 {KEY_F (10), CK_ViewQuit, "F10"},
170 {'?', CK_ViewSearch, "?"},
171 {'/', CK_ViewSearch, "/"},
172 {XCTRL ('r'), CK_ViewContinueSearch, "C-r"},
173 {XCTRL ('s'), CK_ViewContinueSearch, "C-s"},
174 {KEY_F (17), CK_ViewContinueSearch, "S-F7"},
175 {'n', CK_ViewContinueSearch, "n"},
177 {'\t', CK_ViewToggleHexNavMode, "Tab"},
178 {XCTRL ('a'), CK_ViewMoveToBol, "C-a"},
179 {XCTRL ('e'), CK_ViewMoveToEol, "C-e"},
181 {'b', CK_ViewMoveLeft, "b"},
182 {KEY_LEFT, CK_ViewMoveLeft, "Left"},
184 {'f', CK_ViewMoveRight, "f"},
185 {KEY_RIGHT, CK_ViewMoveRight, "Right"},
187 {'k', CK_ViewMoveUp, "k"},
188 {'y', CK_ViewMoveUp, "y"},
189 {KEY_UP, CK_ViewMoveUp, "Up"},
191 {'j', CK_ViewMoveDown, "j"},
192 {KEY_DOWN, CK_ViewMoveDown, "Down"},
193 {KEY_DC, CK_ViewMoveDown, "Delete"},
195 {KEY_NPAGE, CK_ViewMovePgDn, "PgDn"},
196 {XCTRL ('v'), CK_ViewMovePgDn, "C-v"},
198 {KEY_PPAGE, CK_ViewMovePgUp, "PgUp"},
199 {ALT ('v'), CK_ViewMovePgUp, "M-v"},
201 {KEY_HOME, CK_ViewMoveTop, "Home"},
202 {KEY_M_CTRL | KEY_HOME, CK_ViewMoveTop, "C-Home"},
203 {KEY_M_CTRL | KEY_PPAGE, CK_ViewMoveTop, "C-PgUp"},
204 {KEY_A1, CK_ViewMoveTop, "A1"},
205 {ALT ('<'), CK_ViewMoveTop, "M-<"},
206 {'g', CK_ViewMoveTop, "g"},
208 {KEY_END, CK_ViewMoveBottom, "End"},
209 {KEY_M_CTRL | KEY_END, CK_ViewMoveBottom, "C-End"},
210 {KEY_M_CTRL | KEY_NPAGE, CK_ViewMoveBottom, "C-PgDn"},
211 {KEY_C1, CK_ViewMoveBottom, "C1"},
212 {ALT ('>'), CK_ViewMoveBottom, "M->"},
213 {'G', CK_ViewMoveBottom, "G"},
215 {'q', CK_ViewQuit, "q"},
216 {XCTRL ('g'), CK_ViewQuit, "C-g"},
217 {ESC_CHAR, CK_ViewQuit, "Esc"},
219 {ALT ('e'), CK_SelectCodepage, "M-e"},
220 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
222 {0, CK_Ignore_Key, ""}
225 #ifdef USE_INTERNAL_EDIT
226 /* ../edit/editkeys.c */
227 const global_keymap_t default_editor_keymap[] = {
228 {'\n', CK_Enter, "Enter"},
229 {'\t', CK_Tab, "Tab"},
231 {KEY_F (1), CK_Help, "F1"},
232 {KEY_F (2), CK_Save, "F2"},
233 {KEY_F (3), CK_Mark, "F3"},
234 {KEY_F (4), CK_Replace, "F4"},
235 {KEY_F (5), CK_Copy, "F5"},
236 {KEY_F (6), CK_Move, "F6"},
237 {KEY_F (7), CK_Find, "F7"},
238 {KEY_F (8), CK_Remove, "F8"},
239 {KEY_F (9), CK_Menu, "F9"},
240 {KEY_F (10), CK_Quit, "F10"},
241 /* edit user menu */
242 {KEY_F (11), CK_User_Menu, "S-F1"},
243 {KEY_F (12), CK_Save_As, "S-F2"},
244 {KEY_F (13), CK_Column_Mark, "S-F3"},
245 {KEY_F (14), CK_Replace_Again, "S-F4"},
246 {KEY_F (15), CK_Insert_File, "S-F5"},
247 {KEY_F (17), CK_Find_Again, "S-F7"},
248 /* C formatter */
249 {KEY_F (19), CK_Pipe_Block (0), "S-F9"},
251 {ESC_CHAR, CK_Quit, "Esc"},
252 {KEY_BACKSPACE, CK_BackSpace, "BackSpace"},
253 {KEY_DC, CK_Delete, "Delete"},
254 {KEY_DOWN, CK_Down, "Down"},
255 {KEY_END, CK_End, "End"},
256 {KEY_HOME, CK_Home, "Home"},
257 {KEY_IC, CK_Toggle_Insert, "Insert"},
258 {KEY_LEFT, CK_Left, "Left"},
259 {KEY_NPAGE, CK_Page_Down, "PgDn"},
260 {KEY_PPAGE, CK_Page_Up, "PgUp"},
261 {KEY_RIGHT, CK_Right, "Right"},
262 {KEY_UP, CK_Up, "Up"},
264 /* Ctrl */
265 {KEY_M_CTRL | (KEY_F (2)), CK_Save_As, "C-F2"},
266 {KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again, "C-F4"},
267 {KEY_M_CTRL | (KEY_F (7)), CK_Find_Again, "C-F7"},
268 {KEY_M_CTRL | KEY_BACKSPACE, CK_Undo, "C-BackSpace"},
269 {KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text, "C-PgDn"},
270 {KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text, "C-PgUp"},
271 {KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text, "C-Home"},
272 {KEY_M_CTRL | KEY_END, CK_End_Of_Text, "C-End"},
273 {KEY_M_CTRL | KEY_UP, CK_Scroll_Up, "C-Up"},
274 {KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down, "C-Down"},
275 {KEY_M_CTRL | KEY_LEFT, CK_Word_Left, "C-Left"},
276 {XCTRL ('z'), CK_Word_Left, "C-z"},
277 {KEY_M_CTRL | KEY_RIGHT, CK_Word_Right, "C-Right"},
278 {XCTRL ('x'), CK_Word_Right, "C-x"},
279 {KEY_M_CTRL | KEY_IC, CK_XStore, "C-Insert"},
280 {KEY_M_CTRL | KEY_DC, CK_Remove, "C-Delete"},
282 {XCTRL ('n'), CK_New, "C-n"},
283 {XCTRL ('k'), CK_Delete_To_Line_End, "C-k"},
284 {XCTRL ('l'), CK_Refresh, "C-l"},
285 {XCTRL ('o'), CK_Shell, "C-o"},
286 {XCTRL ('s'), CK_Toggle_Syntax, "C-s"},
287 {XCTRL ('u'), CK_Undo, "C-u"},
288 {ALT ('e'), CK_SelectCodepage, "M-e"},
289 {XCTRL ('q'), CK_Insert_Literal, "C-q"},
290 {XCTRL ('r'), CK_Begin_End_Macro, "C-r"},
291 {XCTRL ('r'), CK_Begin_Record_Macro, "C-r"},
292 {XCTRL ('r'), CK_End_Record_Macro, "C-r"},
293 {XCTRL ('a'), CK_Execute_Macro, "C-a"},
294 {XCTRL ('f'), CK_Save_Block, "C-f"},
295 /* Spell check */
296 {XCTRL ('p'), CK_Pipe_Block (1), "C-p"},
297 {XCTRL ('y'), CK_Delete_Line, "C-y"},
299 /* Shift */
300 {KEY_M_SHIFT | KEY_NPAGE, CK_Page_Down_Highlight, "S-PgDn"},
301 {KEY_M_SHIFT | KEY_PPAGE, CK_Page_Up_Highlight, "S-PgUp"},
302 {KEY_M_SHIFT | KEY_LEFT, CK_Left_Highlight, "S-Left"},
303 {KEY_M_SHIFT | KEY_RIGHT, CK_Right_Highlight, "S-Right"},
304 {KEY_M_SHIFT | KEY_UP, CK_Up_Highlight, "S-Up"},
305 {KEY_M_SHIFT | KEY_DOWN, CK_Down_Highlight, "S-Down"},
306 {KEY_M_SHIFT | KEY_HOME, CK_Home_Highlight, "S-Home"},
307 {KEY_M_SHIFT | KEY_END, CK_End_Highlight, "S-End"},
308 {KEY_M_SHIFT | KEY_IC, CK_XPaste, "S-Insert"},
309 {KEY_M_SHIFT | KEY_DC, CK_XCut, "S-Delete"},
310 /* useful for pasting multiline text */
311 {KEY_M_SHIFT | '\n', CK_Return, "S-Enter"},
313 /* Ctrl + Shift */
314 {KEY_M_SHIFT | KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text_Highlight, "C-S-PgDn"},
315 {KEY_M_SHIFT | KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text_Highlight, "C-S-PgUp"},
316 {KEY_M_SHIFT | KEY_M_CTRL | KEY_LEFT, CK_Word_Left_Highlight, "C-S-Left"},
317 {KEY_M_SHIFT | KEY_M_CTRL | KEY_RIGHT, CK_Word_Right_Highlight, "C-S-Right"},
318 {KEY_M_SHIFT | KEY_M_CTRL | KEY_UP, CK_Scroll_Up_Highlight, "C-S-Up"},
319 {KEY_M_SHIFT | KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down_Highlight, "C-S-Down"},
321 /* Alt */
322 {KEY_M_ALT | KEY_NPAGE, CK_Page_Down_Alt_Highlight, "M-PgDn"},
323 {KEY_M_ALT | KEY_PPAGE, CK_Page_Up_Alt_Highlight, "M-PgUp"},
324 {KEY_M_ALT | KEY_LEFT, CK_Left_Alt_Highlight, "M-Left"},
325 {KEY_M_ALT | KEY_RIGHT, CK_Right_Alt_Highlight, "M-Right"},
326 {KEY_M_ALT | KEY_UP, CK_Up_Alt_Highlight, "M-Up"},
327 {KEY_M_ALT | KEY_DOWN, CK_Down_Alt_Highlight, "M-Down"},
328 {KEY_M_ALT | KEY_HOME, CK_Home_Highlight, "M-Home"},
329 {KEY_M_ALT | KEY_END, CK_End_Alt_Highlight, "M-End"},
331 {ALT ('\n'), CK_Find_Definition, "M-Enter"},
332 {ALT ('\t'), CK_Complete_Word, "M-Tab"},
333 {ALT ('l'), CK_Goto, "M-l"},
334 {ALT ('L'), CK_Goto, "M-L"},
335 {ALT ('p'), CK_Paragraph_Format, "M-p"},
336 {ALT ('t'), CK_Sort, "M-t"},
337 {ALT ('u'), CK_ExtCmd, "M-u"},
338 {ALT ('<'), CK_Beginning_Of_Text, "M-<"},
339 {ALT ('>'), CK_End_Of_Text, "M->"},
340 {ALT ('-'), CK_Load_Prev_File, "M--"},
341 {ALT ('+'), CK_Load_Next_File, "M-+"},
342 {ALT ('d'), CK_Delete_Word_Right, "M-d"},
343 {ALT (KEY_BACKSPACE), CK_Delete_Word_Left, "M-BackSpace"},
344 {ALT ('n'), CK_Toggle_Line_State, "M-n"},
345 {ALT ('_'), CK_Toggle_Tab_TWS, "M-_"},
346 {ALT ('k'), CK_Toggle_Bookmark, "M-k"},
347 {ALT ('i'), CK_Prev_Bookmark, "M-i"},
348 {ALT ('j'), CK_Next_Bookmark, "M-j"},
349 {ALT ('o'), CK_Flush_Bookmarks, "M-o"},
350 {ALT ('b'), CK_Match_Bracket, "M-b"},
351 {ALT ('m'), CK_Mail, "M-m"},
353 {XCTRL ('x'), CK_Ext_Mode, "C-x"},
355 {0, CK_Ignore_Key, ""}
358 /* emacs keyboard layout emulation */
359 const global_keymap_t default_editor_x_keymap[] = {
360 {'k', CK_New, "k"},
361 {'e', CK_Execute_Macro, "e"},
362 {0, CK_Ignore_Key, ""}
364 #endif /* USE_INTERNAL_EDIT */
366 /* dialog */
367 const global_keymap_t default_dialog_keymap[] = {
368 {'\n', CK_DialogOK, "Enter"},
369 {KEY_ENTER, CK_DialogOK, "Enter"},
370 {ESC_CHAR, CK_DialogCancel, "Esc"},
371 {XCTRL ('g'), CK_DialogCancel, "C-g"},
372 {KEY_F (10), CK_DialogCancel, "F10"},
373 {KEY_LEFT, CK_DialogPrevItem, "Left"},
374 {KEY_UP, CK_DialogPrevItem, "Up"},
375 {KEY_RIGHT, CK_DialogNextItem, "Right"},
376 {KEY_DOWN, CK_DialogNextItem, "Down"},
377 {KEY_F (1), CK_DialogHelp, "F1"},
378 {XCTRL ('z'), CK_DialogSuspend, "C-z"},
379 {XCTRL ('l'), CK_DialogRefresh, "C-l"},
380 {0, CK_Ignore_Key, ""}
383 /* tree */
384 const global_keymap_t default_tree_keymap[] = {
385 {KEY_F (1), CK_TreeHelp, "F1"},
386 {KEY_F (2), CK_TreeRescan, "F2"},
387 {KEY_F (3), CK_TreeForget, "F3"},
388 {KEY_F (4), CK_TreeToggleNav, "F4"},
389 {KEY_F (5), CK_TreeCopy, "F5"},
390 {KEY_F (6), CK_TreeMove, "F6"},
391 #if 0
392 {KEY_F (7), CK_TreeMake, "F7"},
393 #endif
394 {KEY_F (8), CK_TreeRemove, "F8"},
395 {KEY_UP, CK_TreeMoveUp, "Up"},
396 {XCTRL ('p'), CK_TreeMoveUp, "C-p"},
397 {KEY_DOWN, CK_TreeMoveDown, "Down"},
398 {XCTRL ('n'), CK_TreeMoveDown, "C-n"},
399 {KEY_LEFT, CK_TreeMoveLeft, "Left"},
400 {KEY_RIGHT, CK_TreeMoveRight, "Right"},
401 {KEY_HOME, CK_TreeMoveHome, "Home"},
402 {ALT ('<'), CK_TreeMoveHome, "M-<"},
403 {KEY_A1, CK_TreeMoveHome, "A1"},
404 {KEY_END, CK_TreeMoveEnd, "End"},
405 {ALT ('>'), CK_TreeMoveEnd, "M->"},
406 {KEY_C1, CK_TreeMoveEnd, "C1"},
407 {KEY_PPAGE, CK_TreeMovePgUp, "PgUp"},
408 {ALT ('v'), CK_TreeMovePgUp, "M-v"},
409 {KEY_NPAGE, CK_TreeMovePgDn, "PnDn"},
410 {XCTRL ('v'), CK_TreeMovePgDn, "C-v"},
411 {'\n', CK_TreeOpen, "Enter"},
412 {KEY_ENTER, CK_TreeOpen, "Enter"},
413 {XCTRL ('r'), CK_TreeRescan, "C-r"},
414 {XCTRL ('s'), CK_TreeStartSearch, "C-s"},
415 {ALT ('s'), CK_TreeStartSearch, "M-s"},
416 {KEY_DC, CK_TreeRemove, "Delete"},
417 {0, CK_Ignore_Key, ""}
420 /* help */
421 const global_keymap_t default_help_keymap[] = {
422 {KEY_F (1), CK_HelpHelp, "F1"},
423 {KEY_F (2), CK_HelpIndex, "F2"},
424 {KEY_F (3), CK_HelpBack, "F3"},
425 {KEY_F (10), CK_HelpQuit, "F10"},
426 {KEY_LEFT, CK_HelpBack, "Left"},
427 {'l', CK_HelpBack, "l"},
428 {KEY_DOWN, CK_HelpMoveDown, "Down"},
429 {XCTRL ('n'), CK_HelpMoveDown, "C-n"},
430 {KEY_UP, CK_HelpMoveUp, "Up"},
431 {XCTRL ('p'), CK_HelpMoveUp, "C-p"},
432 {KEY_NPAGE, CK_HelpMovePgDn, "PgDn"},
433 {XCTRL ('v'), CK_HelpMovePgDn, "C-v"},
434 {'f', CK_HelpMovePgDn, "f"},
435 {' ', CK_HelpMovePgDn, "Space"},
436 {KEY_PPAGE, CK_HelpMovePgUp, "PgUp"},
437 {ALT ('v'), CK_HelpMovePgUp, "M-v"},
438 {'b', CK_HelpMovePgUp, "b"},
439 {KEY_BACKSPACE, CK_HelpMovePgUp, "BackSpace"},
440 {'d', CK_HelpMoveHalfPgDn, "d"},
441 {'u', CK_HelpMoveHalfPgUp, "u"},
442 {KEY_HOME, CK_HelpMoveTop, "Home"},
443 {KEY_M_CTRL | KEY_HOME, CK_HelpMoveTop, "C-Home"},
444 {KEY_M_CTRL | KEY_PPAGE, CK_HelpMoveTop, "C-PgUp"},
445 {KEY_A1, CK_HelpMoveTop, "A1"},
446 {ALT ('<'), CK_HelpMoveTop, "M-<"},
447 {'g', CK_HelpMoveTop, "g"},
448 {KEY_END, CK_HelpMoveBottom, "End"},
449 {KEY_M_CTRL | KEY_END, CK_HelpMoveBottom, "C-End"},
450 {KEY_M_CTRL | KEY_NPAGE, CK_HelpMoveBottom, "C-PgDn"},
451 {KEY_C1, CK_HelpMoveBottom, "C1"},
452 {ALT ('>'), CK_HelpMoveBottom, "M->"},
453 {'G', CK_HelpMoveBottom, "G"},
454 {KEY_RIGHT, CK_HelpSelectLink, "Right"},
455 {KEY_ENTER, CK_HelpSelectLink, "Enter"},
456 {'\n', CK_HelpSelectLink, "Enter"},
457 {'\t', CK_HelpNextLink, "Tab"},
458 {ALT ('\t'), CK_HelpPrevLink, "M-Tab"},
459 {'n', CK_HelpNextNode, "n"},
460 {'p', CK_HelpPrevNode, "p"},
461 {ESC_CHAR, CK_HelpQuit, "Esc"},
462 {XCTRL ('g'), CK_HelpQuit, "C-g"},
463 {0, CK_Ignore_Key, ""}
466 /* panel */
467 const global_keymap_t default_panel_keymap[] = {
468 {ALT ('o'), CK_PanelChdirOtherPanel, "M-o"},
469 {ALT ('l'), CK_PanelChdirToReadlink, "M-l"},
470 {KEY_F (15), CK_PanelCmdCopyLocal, "S-F5"},
471 {KEY_F (18), CK_PanelCmdDeleteLocal, "S-F8"},
472 {KEY_ENTER, CK_PanelCmdDoEnter, "Enter"},
473 {'\n', CK_PanelCmdDoEnter, "Enter"},
474 {KEY_F (14), CK_PanelCmdEditNew, "S-F4"},
475 {KEY_F (16), CK_PanelCmdRenameLocal, "S-F6"},
476 {ALT ('*'), CK_PanelCmdReverseSelection, "M-*"},
477 {KEY_KP_ADD, CK_PanelCmdSelect, "M-+"},
478 {KEY_KP_SUBTRACT, CK_PanelCmdUnselect, "M--"},
479 {KEY_F (13), CK_PanelCmdViewSimple, "S-F3"},
480 {KEY_M_CTRL | KEY_NPAGE, CK_PanelCtrlNextPage, "C-PgDn"},
481 {KEY_M_CTRL | KEY_PPAGE, CK_PanelCtrlPrevPage, "C-PgUp"},
482 {ALT ('H'), CK_PanelDirectoryHistoryList, "M-H"},
483 {ALT ('u'), CK_PanelDirectoryHistoryNext, "M-u"},
484 {ALT ('y'), CK_PanelDirectoryHistoryPrev, "M-y"},
485 {ALT ('j'), CK_PanelGotoBottomFile, "M-j"},
486 {ALT ('r'), CK_PanelGotoMiddleFile, "M-r"},
487 {ALT ('g'), CK_PanelGotoTopFile, "M-g"},
488 {KEY_IC, CK_PanelMarkFile, "Insert"},
489 {KEY_UP, CK_PanelMoveUp, "Up"},
490 {KEY_DOWN, CK_PanelMoveDown, "Down"},
491 {KEY_LEFT, CK_PanelMoveLeft, "Left"},
492 {KEY_RIGHT, CK_PanelMoveRight, "Right"},
493 {KEY_END, CK_PanelMoveEnd, "End"},
494 {KEY_C1, CK_PanelMoveEnd, "C1"},
495 {KEY_HOME, CK_PanelMoveHome, "Home"},
496 {KEY_A1, CK_PanelMoveHome, "A1"},
497 {KEY_NPAGE, CK_PanelNextPage, "PgDn"},
498 {KEY_PPAGE, CK_PanelPrevPage, "PgUp"},
499 {ALT ('e'), CK_PanelSetPanelEncoding, "M-e"},
500 {XCTRL ('s'), CK_PanelStartSearch, "C-s"},
501 {ALT ('s'), CK_PanelStartSearch, "M-s"},
502 {ALT ('i'), CK_PanelSyncOtherPanel, "M-i"},
503 {0, CK_Ignore_Key, ""}
506 /* main.c */
507 const global_keymap_t default_main_map[] = {
508 {KEY_F (1), CK_HelpCmd, "F1"},
509 {KEY_F (2), CK_UserMenuCmd, "F2"},
510 {KEY_F (3), CK_ViewCmd, "F3"},
511 {KEY_F (4), CK_EditCmd, "F4"},
512 {KEY_F (5), CK_CopyCmd, "F5"},
513 {KEY_F (6), CK_RenameCmd, "F6"},
514 {KEY_F (7), CK_MkdirCmd, "F7"},
515 {KEY_F (8), CK_DeleteCmd, "F8"},
516 {KEY_F (9), CK_MenuCmd, "F9"},
517 {KEY_F (10), CK_QuitCmd, "F10"},
518 {KEY_F (13), CK_ViewFileCmd, "S-F3"},
519 {KEY_F (19), CK_MenuLastSelectedCmd, "S-F9"},
520 {KEY_F (20), CK_QuietQuitCmd, "S-10"},
521 {ALT ('h'), CK_HistoryCmd, "M-h"},
522 {XCTRL ('@'), CK_SingleDirsizeCmd, "C-Space"},
523 /* Copy useful information to the command line */
524 {ALT ('a'), CK_CopyCurrentPathname, "M-a"},
525 {ALT ('A'), CK_CopyOtherPathname, "M-A"},
526 {ALT ('c'), CK_QuickCdCmd, "M-c"},
527 /* To access the directory hotlist */
528 {XCTRL ('\\'), CK_QuickChdirCmd, "C-\\"},
529 /* Suspend */
530 {XCTRL ('z'), CK_SuspendCmd, "C-z"},
531 /* The filtered view command */
532 {ALT ('!'), CK_FilteredViewCmd, "M-!"},
533 /* Find file */
534 {ALT ('?'), CK_FindCmd, "M-?"},
535 /* Panel refresh */
536 {XCTRL ('r'), CK_RereadCmd, "C-r"},
537 /* Toggle listing between long, user defined and full formats */
538 {ALT ('t'), CK_ToggleListingCmd, "M-t"},
539 /* Swap panels */
540 {XCTRL ('u'), CK_SwapCmd, "C-u"},
541 /* View output */
542 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
543 {ALT ('.'), CK_ToggleShowHidden, "M-."},
544 {ALT (','), CK_TogglePanelsSplit, "M-,"},
545 {XCTRL ('x'), CK_StartExtMap1, "C-x"},
546 /* Select/unselect group */
547 {KEY_KP_ADD, CK_SelectCmd, "+"},
548 {KEY_KP_SUBTRACT, CK_UnselectCmd, "-"},
549 {ALT ('*'), CK_ReverseSelectionCmd, "*"},
551 {ALT ('`'), CK_DialogListCmd, "M-`"},
552 {ALT ('}'), CK_DialogNextCmd, "M-}"},
553 {ALT ('{'), CK_DialogPrevCmd, "M-{"},
555 {0, CK_Ignore_Key, ""}
558 const global_keymap_t default_main_x_map[] = {
559 {'d', CK_CompareDirsCmd, "d"},
560 #ifdef USE_DIFF_VIEW
561 {XCTRL ('d'), CK_DiffViewCmd, "C-d"},
562 #endif /* USE_DIFF_VIEW */
563 #ifdef ENABLE_VFS
564 {'a', CK_ReselectVfs, "a"},
565 #endif /* ENABLE_VFS */
566 {'p', CK_CopyCurrentPathname, "p"},
567 {XCTRL ('p'), CK_CopyOtherPathname, "C-p"},
568 {'t', CK_CopyCurrentTagged, "t"},
569 {XCTRL ('t'), CK_CopyOtherTagged, "C-t"},
570 {'c', CK_ChmodCmd, "c"},
571 {'o', CK_ChownCmd, "o"},
572 {'r', CK_CopyCurrentReadlink, "r"},
573 {XCTRL ('r'), CK_CopyOtherReadlink, "C-r"},
574 {'l', CK_LinkCmd, "l"},
575 {'s', CK_SymlinkCmd, "s"},
576 {'v', CK_RelativeSymlinkCmd, "v"},
577 {XCTRL ('s'), CK_EditSymlinkCmd, "C-s"},
578 {'i', CK_InfoCmd, "i"},
579 {'q', CK_QuickViewCmd, "q"},
580 {'h', CK_AddHotlist, "h"},
581 {'!', CK_ExternalPanelize, "!"},
582 #ifdef WITH_BACKGROUND
583 {'j', CK_JobsCmd, "j"},
584 #endif /* WITH_BACKGROUND */
585 {0, CK_Ignore_Key, ""}
588 const global_keymap_t default_input_keymap[] = {
589 /* Motion */
590 {XCTRL ('a'), CK_InputBol, "C-a"},
591 {KEY_HOME, CK_InputBol, "Home"},
592 {KEY_A1, CK_InputBol, "A1"},
593 {ALT ('<'), CK_InputBol, "M-<"},
594 {XCTRL ('e'), CK_InputEol, "C-e"},
595 {KEY_END, CK_InputEol, "End"},
596 {ALT ('>'), CK_InputEol, "M->"},
597 {KEY_C1, CK_InputEol, "C1"},
598 {KEY_LEFT, CK_InputMoveLeft, "Left"},
599 {KEY_M_CTRL | KEY_LEFT, CK_InputWordLeft, "C-Left"},
600 {KEY_RIGHT, CK_InputMoveRight, "Right"},
601 {KEY_M_CTRL | KEY_RIGHT, CK_InputWordRight, "C-Right"},
603 {XCTRL ('b'), CK_InputBackwardChar, "C-b"},
604 {ALT ('b'), CK_InputBackwardWord, "M-b"},
605 {XCTRL ('f'), CK_InputForwardChar, "C-f"},
606 {ALT ('f'), CK_InputForwardWord, "M-f"},
608 /* Editing */
609 {KEY_BACKSPACE, CK_InputBackwardDelete, "BackSpace"},
610 {KEY_DC, CK_InputDeleteChar, "Delete"},
611 {ALT ('d'), CK_InputKillWord, "M-d"},
612 {ALT (KEY_BACKSPACE), CK_InputBackwardKillWord, "M-BackSpace"},
614 /* Region manipulation */
615 {XCTRL ('w'), CK_InputKillRegion, "C-w"},
616 {ALT ('w'), CK_InputKillSave, "M-w"},
617 {XCTRL ('y'), CK_InputYank, "C-y"},
618 {XCTRL ('k'), CK_InputKillLine, "C-k"},
620 /* History */
621 {ALT ('p'), CK_InputHistoryPrev, "M-p"},
622 {ALT ('n'), CK_InputHistoryNext, "M-n"},
623 {ALT ('h'), CK_InputHistoryShow, "M-h"},
625 /* Completion */
626 {ALT ('\t'), CK_InputComplete, "M-tab"},
628 {0, CK_Ignore_Key, ""}
631 const global_keymap_t default_listbox_keymap[] = {
632 {KEY_UP, CK_ListboxMoveUp, "Up"},
633 {XCTRL ('p'), CK_ListboxMoveUp, "C-p"},
634 {KEY_DOWN, CK_ListboxMoveDown, "Down"},
635 {XCTRL ('n'), CK_ListboxMoveDown, "C-n"},
636 {KEY_HOME, CK_ListboxMoveHome, "Home"},
637 {ALT ('<'), CK_ListboxMoveHome, "M-<"},
638 {KEY_A1, CK_ListboxMoveHome, "A1"},
639 {KEY_END, CK_ListboxMoveEnd, "End"},
640 {ALT ('>'), CK_ListboxMoveEnd, "M->"},
641 {KEY_C1, CK_ListboxMoveEnd, "C1"},
642 {KEY_PPAGE, CK_ListboxMovePgUp, "PgUp"},
643 {ALT ('v'), CK_ListboxMovePgUp, "M-v"},
644 {KEY_NPAGE, CK_ListboxMovePgDn, "PgDn"},
645 {XCTRL ('v'), CK_ListboxMovePgDn, "C-v"},
646 {KEY_DC, CK_ListboxDeleteItem, "Delete"},
647 {'d', CK_ListboxDeleteItem, "d"},
648 {KEY_M_SHIFT | KEY_DC, CK_ListboxDeleteAll, "S-Delete"},
649 {'D', CK_ListboxDeleteAll, "D"},
651 {0, CK_Ignore_Key, ""}
654 #ifdef USE_DIFF_VIEW
655 /* diff viewer */
656 const global_keymap_t default_diff_keymap[] = {
658 {'s', CK_DiffDisplaySymbols, "s"},
659 {'l', CK_DiffDisplayNumbers, "l"},
660 {'f', CK_DiffFull, "f"},
661 {'=', CK_DiffEqual, "="},
662 {'>', CK_DiffSplitMore, ">"},
663 {'<', CK_DiffSplitLess, "<"},
664 {'2', CK_DiffSetTab2, "2"},
665 {'3', CK_DiffSetTab3, "3"},
666 {'4', CK_DiffSetTab4, "4"},
667 {'8', CK_DiffSetTab8, "8"},
668 {XCTRL ('u'), CK_DiffSwapPanel, "C-u"},
669 {XCTRL ('r'), CK_DiffRedo, "C-r"},
670 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
671 {'n', CK_DiffNextHunk, "n"},
672 {'p', CK_DiffPrevHunk, "p"},
673 {'g', CK_DiffGoto, "g"},
674 {'G', CK_DiffGoto, "G"},
675 {KEY_M_CTRL | KEY_HOME, CK_DiffBOF, "C-Home"},
676 {KEY_M_CTRL | KEY_END, CK_DiffEOF, "C-End"},
677 {KEY_DOWN, CK_DiffDown, "Down"},
678 {KEY_UP, CK_DiffUp, "Up"},
679 {KEY_M_CTRL | KEY_LEFT, CK_DiffQuickLeft, "C-Left"},
680 {KEY_M_CTRL | KEY_RIGHT, CK_DiffQuickRight, "C-Right"},
681 {KEY_LEFT, CK_DiffLeft, "Left"},
682 {KEY_RIGHT, CK_DiffRight, "Right"},
683 {KEY_NPAGE, CK_DiffPageDown, "Down"},
684 {KEY_PPAGE, CK_DiffPageUp, "Up"},
685 {KEY_HOME, CK_DiffHome, "Home"},
686 {KEY_END, CK_DiffEnd, "End"},
687 {'q', CK_DiffQuit, "q"},
688 {'Q', CK_DiffQuit, "Q"},
689 {XCTRL ('g'), CK_DiffQuit, "C-g"},
690 {ESC_CHAR, CK_DiffQuit, "Esc"},
692 {KEY_F (1), CK_DiffHelp, "F1"},
693 {KEY_F (4), CK_DiffEditCurrent, "F4"},
694 {KEY_F (5), CK_DiffMergeCurrentHunk, "F5"},
695 {KEY_F (7), CK_DiffSearch, "F7"},
696 {KEY_F (17), CK_DiffContinueSearch, "S-F7"},
697 {KEY_F (9), CK_DiffOptions, "F9"},
698 {KEY_F (10), CK_DiffQuit, "F10"},
699 {KEY_F (14), CK_DiffEditOther, "S-F4"},
701 {0, CK_Ignore_Key, ""}
703 #endif
705 /*** file scope macro definitions ****************************************************************/
707 /*** file scope type declarations ****************************************************************/
709 /*** file scope variables ************************************************************************/
711 /*** file scope functions ************************************************************************/
712 /* --------------------------------------------------------------------------------------------- */
714 /* --------------------------------------------------------------------------------------------- */
715 /*** public functions ****************************************************************************/
716 /* --------------------------------------------------------------------------------------------- */