Ticket #2448: division by zero in file copy progress dialog.
[midnight-commander.git] / src / keybind-defaults.c
blobc17ec0778e2c0a6ad445632e593da6d710d45031
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_BACKSPACE, CK_BackSpace, "C-h"},
254 {KEY_DC, CK_Delete, "Delete"},
255 {KEY_DC, CK_Delete, "C-d"},
256 {KEY_DOWN, CK_Down, "Down"},
257 {KEY_END, CK_End, "End"},
258 {KEY_HOME, CK_Home, "Home"},
259 {KEY_IC, CK_Toggle_Insert, "Insert"},
260 {KEY_LEFT, CK_Left, "Left"},
261 {KEY_NPAGE, CK_Page_Down, "PgDn"},
262 {KEY_PPAGE, CK_Page_Up, "PgUp"},
263 {KEY_RIGHT, CK_Right, "Right"},
264 {KEY_UP, CK_Up, "Up"},
266 /* Ctrl */
267 {KEY_M_CTRL | (KEY_F (2)), CK_Save_As, "C-F2"},
268 {KEY_M_CTRL | (KEY_F (4)), CK_Replace_Again, "C-F4"},
269 {KEY_M_CTRL | (KEY_F (7)), CK_Find_Again, "C-F7"},
270 {KEY_M_CTRL | KEY_BACKSPACE, CK_Undo, "C-BackSpace"},
271 {KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text, "C-PgDn"},
272 {KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text, "C-PgUp"},
273 {KEY_M_CTRL | KEY_HOME, CK_Beginning_Of_Text, "C-Home"},
274 {KEY_M_CTRL | KEY_END, CK_End_Of_Text, "C-End"},
275 {KEY_M_CTRL | KEY_UP, CK_Scroll_Up, "C-Up"},
276 {KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down, "C-Down"},
277 {KEY_M_CTRL | KEY_LEFT, CK_Word_Left, "C-Left"},
278 {XCTRL ('z'), CK_Word_Left, "C-z"},
279 {KEY_M_CTRL | KEY_RIGHT, CK_Word_Right, "C-Right"},
280 {XCTRL ('x'), CK_Word_Right, "C-x"},
281 {KEY_M_CTRL | KEY_IC, CK_XStore, "C-Insert"},
282 {KEY_M_CTRL | KEY_DC, CK_Remove, "C-Delete"},
284 {XCTRL ('n'), CK_New, "C-n"},
285 {XCTRL ('k'), CK_Delete_To_Line_End, "C-k"},
286 {XCTRL ('l'), CK_Refresh, "C-l"},
287 {XCTRL ('o'), CK_Shell, "C-o"},
288 {XCTRL ('s'), CK_Toggle_Syntax, "C-s"},
289 {XCTRL ('u'), CK_Undo, "C-u"},
290 {ALT ('e'), CK_SelectCodepage, "M-e"},
291 {XCTRL ('q'), CK_Insert_Literal, "C-q"},
292 {XCTRL ('r'), CK_Begin_End_Macro, "C-r"},
293 {XCTRL ('r'), CK_Begin_Record_Macro, "C-r"},
294 {XCTRL ('r'), CK_End_Record_Macro, "C-r"},
295 {XCTRL ('a'), CK_Execute_Macro, "C-a"},
296 {XCTRL ('f'), CK_Save_Block, "C-f"},
297 /* Spell check */
298 {XCTRL ('p'), CK_Pipe_Block (1), "C-p"},
299 {XCTRL ('y'), CK_Delete_Line, "C-y"},
301 /* Shift */
302 {KEY_M_SHIFT | KEY_NPAGE, CK_Page_Down_Highlight, "S-PgDn"},
303 {KEY_M_SHIFT | KEY_PPAGE, CK_Page_Up_Highlight, "S-PgUp"},
304 {KEY_M_SHIFT | KEY_LEFT, CK_Left_Highlight, "S-Left"},
305 {KEY_M_SHIFT | KEY_RIGHT, CK_Right_Highlight, "S-Right"},
306 {KEY_M_SHIFT | KEY_UP, CK_Up_Highlight, "S-Up"},
307 {KEY_M_SHIFT | KEY_DOWN, CK_Down_Highlight, "S-Down"},
308 {KEY_M_SHIFT | KEY_HOME, CK_Home_Highlight, "S-Home"},
309 {KEY_M_SHIFT | KEY_END, CK_End_Highlight, "S-End"},
310 {KEY_M_SHIFT | KEY_IC, CK_XPaste, "S-Insert"},
311 {KEY_M_SHIFT | KEY_DC, CK_XCut, "S-Delete"},
312 /* useful for pasting multiline text */
313 {KEY_M_SHIFT | '\n', CK_Return, "S-Enter"},
315 /* Ctrl + Shift */
316 {KEY_M_SHIFT | KEY_M_CTRL | KEY_NPAGE, CK_End_Of_Text_Highlight, "C-S-PgDn"},
317 {KEY_M_SHIFT | KEY_M_CTRL | KEY_PPAGE, CK_Beginning_Of_Text_Highlight, "C-S-PgUp"},
318 {KEY_M_SHIFT | KEY_M_CTRL | KEY_LEFT, CK_Word_Left_Highlight, "C-S-Left"},
319 {KEY_M_SHIFT | KEY_M_CTRL | KEY_RIGHT, CK_Word_Right_Highlight, "C-S-Right"},
320 {KEY_M_SHIFT | KEY_M_CTRL | KEY_UP, CK_Scroll_Up_Highlight, "C-S-Up"},
321 {KEY_M_SHIFT | KEY_M_CTRL | KEY_DOWN, CK_Scroll_Down_Highlight, "C-S-Down"},
323 /* Alt */
324 {KEY_M_ALT | KEY_NPAGE, CK_Page_Down_Alt_Highlight, "M-PgDn"},
325 {KEY_M_ALT | KEY_PPAGE, CK_Page_Up_Alt_Highlight, "M-PgUp"},
326 {KEY_M_ALT | KEY_LEFT, CK_Left_Alt_Highlight, "M-Left"},
327 {KEY_M_ALT | KEY_RIGHT, CK_Right_Alt_Highlight, "M-Right"},
328 {KEY_M_ALT | KEY_UP, CK_Up_Alt_Highlight, "M-Up"},
329 {KEY_M_ALT | KEY_DOWN, CK_Down_Alt_Highlight, "M-Down"},
330 {KEY_M_ALT | KEY_HOME, CK_Home_Highlight, "M-Home"},
331 {KEY_M_ALT | KEY_END, CK_End_Alt_Highlight, "M-End"},
333 {ALT ('\n'), CK_Find_Definition, "M-Enter"},
334 {ALT ('\t'), CK_Complete_Word, "M-Tab"},
335 {ALT ('l'), CK_Goto, "M-l"},
336 {ALT ('L'), CK_Goto, "M-L"},
337 {ALT ('p'), CK_Paragraph_Format, "M-p"},
338 {ALT ('t'), CK_Sort, "M-t"},
339 {ALT ('u'), CK_ExtCmd, "M-u"},
340 {ALT ('<'), CK_Beginning_Of_Text, "M-<"},
341 {ALT ('>'), CK_End_Of_Text, "M->"},
342 {ALT ('-'), CK_Load_Prev_File, "M--"},
343 {ALT ('+'), CK_Load_Next_File, "M-+"},
344 {ALT ('d'), CK_Delete_Word_Right, "M-d"},
345 {ALT (KEY_BACKSPACE), CK_Delete_Word_Left, "M-BackSpace"},
346 {ALT ('n'), CK_Toggle_Line_State, "M-n"},
347 {ALT ('_'), CK_Toggle_Tab_TWS, "M-_"},
348 {ALT ('k'), CK_Toggle_Bookmark, "M-k"},
349 {ALT ('i'), CK_Prev_Bookmark, "M-i"},
350 {ALT ('j'), CK_Next_Bookmark, "M-j"},
351 {ALT ('o'), CK_Flush_Bookmarks, "M-o"},
352 {ALT ('b'), CK_Match_Bracket, "M-b"},
353 {ALT ('m'), CK_Mail, "M-m"},
355 {XCTRL ('x'), CK_Ext_Mode, "C-x"},
357 {0, CK_Ignore_Key, ""}
360 /* emacs keyboard layout emulation */
361 const global_keymap_t default_editor_x_keymap[] = {
362 {'k', CK_New, "k"},
363 {'e', CK_Execute_Macro, "e"},
364 {0, CK_Ignore_Key, ""}
366 #endif /* USE_INTERNAL_EDIT */
368 /* dialog */
369 const global_keymap_t default_dialog_keymap[] = {
370 {'\n', CK_DialogOK, "Enter"},
371 {KEY_ENTER, CK_DialogOK, "Enter"},
372 {ESC_CHAR, CK_DialogCancel, "Esc"},
373 {XCTRL ('g'), CK_DialogCancel, "C-g"},
374 {KEY_F (10), CK_DialogCancel, "F10"},
375 {KEY_LEFT, CK_DialogPrevItem, "Left"},
376 {KEY_UP, CK_DialogPrevItem, "Up"},
377 {KEY_RIGHT, CK_DialogNextItem, "Right"},
378 {KEY_DOWN, CK_DialogNextItem, "Down"},
379 {KEY_F (1), CK_DialogHelp, "F1"},
380 {XCTRL ('z'), CK_DialogSuspend, "C-z"},
381 {XCTRL ('l'), CK_DialogRefresh, "C-l"},
382 {0, CK_Ignore_Key, ""}
385 /* tree */
386 const global_keymap_t default_tree_keymap[] = {
387 {KEY_F (1), CK_TreeHelp, "F1"},
388 {KEY_F (2), CK_TreeRescan, "F2"},
389 {KEY_F (3), CK_TreeForget, "F3"},
390 {KEY_F (4), CK_TreeToggleNav, "F4"},
391 {KEY_F (5), CK_TreeCopy, "F5"},
392 {KEY_F (6), CK_TreeMove, "F6"},
393 #if 0
394 {KEY_F (7), CK_TreeMake, "F7"},
395 #endif
396 {KEY_F (8), CK_TreeRemove, "F8"},
397 {KEY_UP, CK_TreeMoveUp, "Up"},
398 {XCTRL ('p'), CK_TreeMoveUp, "C-p"},
399 {KEY_DOWN, CK_TreeMoveDown, "Down"},
400 {XCTRL ('n'), CK_TreeMoveDown, "C-n"},
401 {KEY_LEFT, CK_TreeMoveLeft, "Left"},
402 {KEY_RIGHT, CK_TreeMoveRight, "Right"},
403 {KEY_HOME, CK_TreeMoveHome, "Home"},
404 {ALT ('<'), CK_TreeMoveHome, "M-<"},
405 {KEY_A1, CK_TreeMoveHome, "A1"},
406 {KEY_END, CK_TreeMoveEnd, "End"},
407 {ALT ('>'), CK_TreeMoveEnd, "M->"},
408 {KEY_C1, CK_TreeMoveEnd, "C1"},
409 {KEY_PPAGE, CK_TreeMovePgUp, "PgUp"},
410 {ALT ('v'), CK_TreeMovePgUp, "M-v"},
411 {KEY_NPAGE, CK_TreeMovePgDn, "PnDn"},
412 {XCTRL ('v'), CK_TreeMovePgDn, "C-v"},
413 {'\n', CK_TreeOpen, "Enter"},
414 {KEY_ENTER, CK_TreeOpen, "Enter"},
415 {XCTRL ('r'), CK_TreeRescan, "C-r"},
416 {XCTRL ('s'), CK_TreeStartSearch, "C-s"},
417 {ALT ('s'), CK_TreeStartSearch, "M-s"},
418 {KEY_DC, CK_TreeRemove, "Delete"},
419 {0, CK_Ignore_Key, ""}
422 /* help */
423 const global_keymap_t default_help_keymap[] = {
424 {KEY_F (1), CK_HelpHelp, "F1"},
425 {KEY_F (2), CK_HelpIndex, "F2"},
426 {KEY_F (3), CK_HelpBack, "F3"},
427 {KEY_F (10), CK_HelpQuit, "F10"},
428 {KEY_LEFT, CK_HelpBack, "Left"},
429 {'l', CK_HelpBack, "l"},
430 {KEY_DOWN, CK_HelpMoveDown, "Down"},
431 {XCTRL ('n'), CK_HelpMoveDown, "C-n"},
432 {KEY_UP, CK_HelpMoveUp, "Up"},
433 {XCTRL ('p'), CK_HelpMoveUp, "C-p"},
434 {KEY_NPAGE, CK_HelpMovePgDn, "PgDn"},
435 {XCTRL ('v'), CK_HelpMovePgDn, "C-v"},
436 {'f', CK_HelpMovePgDn, "f"},
437 {' ', CK_HelpMovePgDn, "Space"},
438 {KEY_PPAGE, CK_HelpMovePgUp, "PgUp"},
439 {ALT ('v'), CK_HelpMovePgUp, "M-v"},
440 {'b', CK_HelpMovePgUp, "b"},
441 {KEY_BACKSPACE, CK_HelpMovePgUp, "BackSpace"},
442 {'d', CK_HelpMoveHalfPgDn, "d"},
443 {'u', CK_HelpMoveHalfPgUp, "u"},
444 {KEY_HOME, CK_HelpMoveTop, "Home"},
445 {KEY_M_CTRL | KEY_HOME, CK_HelpMoveTop, "C-Home"},
446 {KEY_M_CTRL | KEY_PPAGE, CK_HelpMoveTop, "C-PgUp"},
447 {KEY_A1, CK_HelpMoveTop, "A1"},
448 {ALT ('<'), CK_HelpMoveTop, "M-<"},
449 {'g', CK_HelpMoveTop, "g"},
450 {KEY_END, CK_HelpMoveBottom, "End"},
451 {KEY_M_CTRL | KEY_END, CK_HelpMoveBottom, "C-End"},
452 {KEY_M_CTRL | KEY_NPAGE, CK_HelpMoveBottom, "C-PgDn"},
453 {KEY_C1, CK_HelpMoveBottom, "C1"},
454 {ALT ('>'), CK_HelpMoveBottom, "M->"},
455 {'G', CK_HelpMoveBottom, "G"},
456 {KEY_RIGHT, CK_HelpSelectLink, "Right"},
457 {KEY_ENTER, CK_HelpSelectLink, "Enter"},
458 {'\n', CK_HelpSelectLink, "Enter"},
459 {'\t', CK_HelpNextLink, "Tab"},
460 {ALT ('\t'), CK_HelpPrevLink, "M-Tab"},
461 {'n', CK_HelpNextNode, "n"},
462 {'p', CK_HelpPrevNode, "p"},
463 {ESC_CHAR, CK_HelpQuit, "Esc"},
464 {XCTRL ('g'), CK_HelpQuit, "C-g"},
465 {0, CK_Ignore_Key, ""}
468 /* panel */
469 const global_keymap_t default_panel_keymap[] = {
470 {ALT ('o'), CK_PanelChdirOtherPanel, "M-o"},
471 {ALT ('l'), CK_PanelChdirToReadlink, "M-l"},
472 {KEY_F (15), CK_PanelCmdCopyLocal, "S-F5"},
473 {KEY_F (18), CK_PanelCmdDeleteLocal, "S-F8"},
474 {KEY_ENTER, CK_PanelCmdDoEnter, "Enter"},
475 {'\n', CK_PanelCmdDoEnter, "Enter"},
476 {KEY_F (14), CK_PanelCmdEditNew, "S-F4"},
477 {KEY_F (16), CK_PanelCmdRenameLocal, "S-F6"},
478 {ALT ('*'), CK_PanelCmdReverseSelection, "M-*"},
479 {KEY_KP_ADD, CK_PanelCmdSelect, "M-+"},
480 {KEY_KP_SUBTRACT, CK_PanelCmdUnselect, "M--"},
481 {KEY_F (13), CK_PanelCmdViewSimple, "S-F3"},
482 {KEY_M_CTRL | KEY_NPAGE, CK_PanelGotoChildDir, "C-PgDn"},
483 {KEY_M_CTRL | KEY_PPAGE, CK_PanelGotoParentDir, "C-PgUp"},
484 {ALT ('H'), CK_PanelDirectoryHistoryList, "M-H"},
485 {ALT ('u'), CK_PanelDirectoryHistoryNext, "M-u"},
486 {ALT ('y'), CK_PanelDirectoryHistoryPrev, "M-y"},
487 {ALT ('j'), CK_PanelGotoBottomFile, "M-j"},
488 {ALT ('r'), CK_PanelGotoMiddleFile, "M-r"},
489 {ALT ('g'), CK_PanelGotoTopFile, "M-g"},
490 {KEY_IC, CK_PanelMarkFile, "Insert"},
491 {KEY_UP, CK_PanelMoveUp, "Up"},
492 {KEY_DOWN, CK_PanelMoveDown, "Down"},
493 {KEY_LEFT, CK_PanelMoveLeft, "Left"},
494 {KEY_RIGHT, CK_PanelMoveRight, "Right"},
495 {KEY_END, CK_PanelMoveEnd, "End"},
496 {KEY_C1, CK_PanelMoveEnd, "C1"},
497 {KEY_HOME, CK_PanelMoveHome, "Home"},
498 {KEY_A1, CK_PanelMoveHome, "A1"},
499 {KEY_NPAGE, CK_PanelNextPage, "PgDn"},
500 {KEY_PPAGE, CK_PanelPrevPage, "PgUp"},
501 {ALT ('e'), CK_PanelSetPanelEncoding, "M-e"},
502 {XCTRL ('s'), CK_PanelStartSearch, "C-s"},
503 {ALT ('s'), CK_PanelStartSearch, "M-s"},
504 {ALT ('i'), CK_PanelSyncOtherPanel, "M-i"},
505 {0, CK_Ignore_Key, ""}
508 /* main.c */
509 const global_keymap_t default_main_map[] = {
510 {KEY_F (1), CK_HelpCmd, "F1"},
511 {KEY_F (2), CK_UserMenuCmd, "F2"},
512 {KEY_F (3), CK_ViewCmd, "F3"},
513 {KEY_F (4), CK_EditCmd, "F4"},
514 {KEY_F (5), CK_CopyCmd, "F5"},
515 {KEY_F (6), CK_RenameCmd, "F6"},
516 {KEY_F (7), CK_MkdirCmd, "F7"},
517 {KEY_F (8), CK_DeleteCmd, "F8"},
518 {KEY_F (9), CK_MenuCmd, "F9"},
519 {KEY_F (10), CK_QuitCmd, "F10"},
520 {KEY_F (13), CK_ViewFileCmd, "S-F3"},
521 {KEY_F (19), CK_MenuLastSelectedCmd, "S-F9"},
522 {KEY_F (20), CK_QuietQuitCmd, "S-10"},
523 {ALT ('h'), CK_HistoryCmd, "M-h"},
524 {XCTRL ('@'), CK_SingleDirsizeCmd, "C-Space"},
525 /* Copy useful information to the command line */
526 {ALT ('a'), CK_CopyCurrentPathname, "M-a"},
527 {ALT ('A'), CK_CopyOtherPathname, "M-A"},
528 {ALT ('c'), CK_QuickCdCmd, "M-c"},
529 /* To access the directory hotlist */
530 {XCTRL ('\\'), CK_QuickChdirCmd, "C-\\"},
531 /* Suspend */
532 {XCTRL ('z'), CK_SuspendCmd, "C-z"},
533 /* The filtered view command */
534 {ALT ('!'), CK_FilteredViewCmd, "M-!"},
535 /* Find file */
536 {ALT ('?'), CK_FindCmd, "M-?"},
537 /* Panel refresh */
538 {XCTRL ('r'), CK_RereadCmd, "C-r"},
539 /* Toggle listing between long, user defined and full formats */
540 {ALT ('t'), CK_ToggleListingCmd, "M-t"},
541 /* Swap panels */
542 {XCTRL ('u'), CK_SwapCmd, "C-u"},
543 /* View output */
544 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
545 {ALT ('.'), CK_ToggleShowHidden, "M-."},
546 {ALT (','), CK_TogglePanelsSplit, "M-,"},
547 {XCTRL ('x'), CK_StartExtMap1, "C-x"},
548 /* Select/unselect group */
549 {KEY_KP_ADD, CK_SelectCmd, "+"},
550 {KEY_KP_SUBTRACT, CK_UnselectCmd, "-"},
551 {ALT ('*'), CK_ReverseSelectionCmd, "*"},
553 {ALT ('`'), CK_DialogListCmd, "M-`"},
554 {ALT ('}'), CK_DialogNextCmd, "M-}"},
555 {ALT ('{'), CK_DialogPrevCmd, "M-{"},
557 {0, CK_Ignore_Key, ""}
560 const global_keymap_t default_main_x_map[] = {
561 {'d', CK_CompareDirsCmd, "d"},
562 #ifdef USE_DIFF_VIEW
563 {XCTRL ('d'), CK_DiffViewCmd, "C-d"},
564 #endif /* USE_DIFF_VIEW */
565 #ifdef ENABLE_VFS
566 {'a', CK_ReselectVfs, "a"},
567 #endif /* ENABLE_VFS */
568 {'p', CK_CopyCurrentPathname, "p"},
569 {XCTRL ('p'), CK_CopyOtherPathname, "C-p"},
570 {'t', CK_CopyCurrentTagged, "t"},
571 {XCTRL ('t'), CK_CopyOtherTagged, "C-t"},
572 {'c', CK_ChmodCmd, "c"},
573 {'o', CK_ChownCmd, "o"},
574 {'r', CK_CopyCurrentReadlink, "r"},
575 {XCTRL ('r'), CK_CopyOtherReadlink, "C-r"},
576 {'l', CK_LinkCmd, "l"},
577 {'s', CK_SymlinkCmd, "s"},
578 {'v', CK_RelativeSymlinkCmd, "v"},
579 {XCTRL ('s'), CK_EditSymlinkCmd, "C-s"},
580 {'i', CK_InfoCmd, "i"},
581 {'q', CK_QuickViewCmd, "q"},
582 {'h', CK_AddHotlist, "h"},
583 {'!', CK_ExternalPanelize, "!"},
584 #ifdef WITH_BACKGROUND
585 {'j', CK_JobsCmd, "j"},
586 #endif /* WITH_BACKGROUND */
587 {0, CK_Ignore_Key, ""}
590 const global_keymap_t default_input_keymap[] = {
591 /* Motion */
592 {XCTRL ('a'), CK_InputBol, "C-a"},
593 {KEY_HOME, CK_InputBol, "Home"},
594 {KEY_A1, CK_InputBol, "A1"},
595 {ALT ('<'), CK_InputBol, "M-<"},
596 {XCTRL ('e'), CK_InputEol, "C-e"},
597 {KEY_END, CK_InputEol, "End"},
598 {ALT ('>'), CK_InputEol, "M->"},
599 {KEY_C1, CK_InputEol, "C1"},
600 {KEY_LEFT, CK_InputMoveLeft, "Left"},
601 {KEY_M_CTRL | KEY_LEFT, CK_InputWordLeft, "C-Left"},
602 {KEY_RIGHT, CK_InputMoveRight, "Right"},
603 {KEY_M_CTRL | KEY_RIGHT, CK_InputWordRight, "C-Right"},
605 {XCTRL ('b'), CK_InputBackwardChar, "C-b"},
606 {ALT ('b'), CK_InputBackwardWord, "M-b"},
607 {XCTRL ('f'), CK_InputForwardChar, "C-f"},
608 {ALT ('f'), CK_InputForwardWord, "M-f"},
610 /* Editing */
611 {KEY_BACKSPACE, CK_InputBackwardDelete, "BackSpace"},
612 {KEY_BACKSPACE, CK_InputBackwardDelete, "C-h"},
613 {KEY_DC, CK_InputDeleteChar, "Delete"},
614 {KEY_DC, CK_InputDeleteChar, "C-d"},
615 {ALT ('d'), CK_InputKillWord, "M-d"},
616 {ALT (KEY_BACKSPACE), CK_InputBackwardKillWord, "M-BackSpace"},
618 /* Region manipulation */
619 {XCTRL ('w'), CK_InputKillRegion, "C-w"},
620 {ALT ('w'), CK_InputKillSave, "M-w"},
621 {XCTRL ('y'), CK_InputYank, "C-y"},
622 {XCTRL ('k'), CK_InputKillLine, "C-k"},
624 /* History */
625 {ALT ('p'), CK_InputHistoryPrev, "M-p"},
626 {ALT ('n'), CK_InputHistoryNext, "M-n"},
627 {ALT ('h'), CK_InputHistoryShow, "M-h"},
629 /* Completion */
630 {ALT ('\t'), CK_InputComplete, "M-tab"},
632 {0, CK_Ignore_Key, ""}
635 const global_keymap_t default_listbox_keymap[] = {
636 {KEY_UP, CK_ListboxMoveUp, "Up"},
637 {XCTRL ('p'), CK_ListboxMoveUp, "C-p"},
638 {KEY_DOWN, CK_ListboxMoveDown, "Down"},
639 {XCTRL ('n'), CK_ListboxMoveDown, "C-n"},
640 {KEY_HOME, CK_ListboxMoveHome, "Home"},
641 {ALT ('<'), CK_ListboxMoveHome, "M-<"},
642 {KEY_A1, CK_ListboxMoveHome, "A1"},
643 {KEY_END, CK_ListboxMoveEnd, "End"},
644 {ALT ('>'), CK_ListboxMoveEnd, "M->"},
645 {KEY_C1, CK_ListboxMoveEnd, "C1"},
646 {KEY_PPAGE, CK_ListboxMovePgUp, "PgUp"},
647 {ALT ('v'), CK_ListboxMovePgUp, "M-v"},
648 {KEY_NPAGE, CK_ListboxMovePgDn, "PgDn"},
649 {XCTRL ('v'), CK_ListboxMovePgDn, "C-v"},
650 {KEY_DC, CK_ListboxDeleteItem, "Delete"},
651 {'d', CK_ListboxDeleteItem, "d"},
652 {KEY_M_SHIFT | KEY_DC, CK_ListboxDeleteAll, "S-Delete"},
653 {'D', CK_ListboxDeleteAll, "D"},
655 {0, CK_Ignore_Key, ""}
658 #ifdef USE_DIFF_VIEW
659 /* diff viewer */
660 const global_keymap_t default_diff_keymap[] = {
662 {'s', CK_DiffDisplaySymbols, "s"},
663 {'l', CK_DiffDisplayNumbers, "l"},
664 {'f', CK_DiffFull, "f"},
665 {'=', CK_DiffEqual, "="},
666 {'>', CK_DiffSplitMore, ">"},
667 {'<', CK_DiffSplitLess, "<"},
668 {'2', CK_DiffSetTab2, "2"},
669 {'3', CK_DiffSetTab3, "3"},
670 {'4', CK_DiffSetTab4, "4"},
671 {'8', CK_DiffSetTab8, "8"},
672 {XCTRL ('u'), CK_DiffSwapPanel, "C-u"},
673 {XCTRL ('r'), CK_DiffRedo, "C-r"},
674 {XCTRL ('o'), CK_ShowCommandLine, "C-o"},
675 {'n', CK_DiffNextHunk, "n"},
676 {'p', CK_DiffPrevHunk, "p"},
677 {'g', CK_DiffGoto, "g"},
678 {'G', CK_DiffGoto, "G"},
679 {KEY_M_CTRL | KEY_HOME, CK_DiffBOF, "C-Home"},
680 {KEY_M_CTRL | KEY_END, CK_DiffEOF, "C-End"},
681 {KEY_DOWN, CK_DiffDown, "Down"},
682 {KEY_UP, CK_DiffUp, "Up"},
683 {KEY_M_CTRL | KEY_LEFT, CK_DiffQuickLeft, "C-Left"},
684 {KEY_M_CTRL | KEY_RIGHT, CK_DiffQuickRight, "C-Right"},
685 {KEY_LEFT, CK_DiffLeft, "Left"},
686 {KEY_RIGHT, CK_DiffRight, "Right"},
687 {KEY_NPAGE, CK_DiffPageDown, "Down"},
688 {KEY_PPAGE, CK_DiffPageUp, "Up"},
689 {KEY_HOME, CK_DiffHome, "Home"},
690 {KEY_END, CK_DiffEnd, "End"},
691 {'q', CK_DiffQuit, "q"},
692 {'Q', CK_DiffQuit, "Q"},
693 {XCTRL ('g'), CK_DiffQuit, "C-g"},
694 {ESC_CHAR, CK_DiffQuit, "Esc"},
696 {KEY_F (1), CK_DiffHelp, "F1"},
697 {KEY_F (4), CK_DiffEditCurrent, "F4"},
698 {KEY_F (5), CK_DiffMergeCurrentHunk, "F5"},
699 {KEY_F (7), CK_DiffSearch, "F7"},
700 {KEY_F (17), CK_DiffContinueSearch, "S-F7"},
701 {KEY_F (9), CK_DiffOptions, "F9"},
702 {KEY_F (10), CK_DiffQuit, "F10"},
703 {KEY_F (14), CK_DiffEditOther, "S-F4"},
705 {0, CK_Ignore_Key, ""}
707 #endif
709 /*** file scope macro definitions ****************************************************************/
711 /*** file scope type declarations ****************************************************************/
713 /*** file scope variables ************************************************************************/
715 /*** file scope functions ************************************************************************/
716 /* --------------------------------------------------------------------------------------------- */
718 /* --------------------------------------------------------------------------------------------- */
719 /*** public functions ****************************************************************************/
720 /* --------------------------------------------------------------------------------------------- */