2 Copyright (C) 2009 The Free Software Foundation, Inc.
4 Written by: 2005 Vitja Makarov
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,
33 #include <sys/types.h>
39 #include "cmddef.h" /* CK_ cmd name const */
41 #include "tty/key.h" /* KEY_M_ */
42 #include "tty/tty.h" /* keys */
48 static const name_key_map_t command_names
[] = {
49 { "EditNoCommand", CK_Ignore_Key
},
50 { "EditIgnoreKey", CK_Ignore_Key
},
51 { "EditBackSpace", CK_BackSpace
},
52 { "EditDelete", CK_Delete
},
53 { "EditEnter", CK_Enter
},
54 { "EditPageUp", CK_Page_Up
},
55 { "EditPageDown", CK_Page_Down
},
56 { "EditLeft", CK_Left
},
57 { "EditRight", CK_Right
},
58 { "EditWordLeft", CK_Word_Left
},
59 { "EditWordRight", CK_Word_Right
},
61 { "EditDown", CK_Down
},
62 { "EditHome", CK_Home
},
63 { "EditEnd", CK_End
},
64 { "EditTab", CK_Tab
},
65 { "EditUndo", CK_Undo
},
66 { "EditBeginningOfText", CK_Beginning_Of_Text
},
67 { "EditEndOfText", CK_End_Of_Text
},
68 { "EditScrollUp", CK_Scroll_Up
},
69 { "EditScrollDown", CK_Scroll_Down
},
70 { "EditReturn", CK_Return
},
71 { "EditBeginPage", CK_Begin_Page
},
72 { "EditEndPage", CK_End_Page
},
73 { "EditDeleteWordLeft", CK_Delete_Word_Left
},
74 { "EditDeleteWordRight", CK_Delete_Word_Right
},
75 { "EditParagraphUp", CK_Paragraph_Up
},
76 { "EditParagraphDown", CK_Paragraph_Down
},
77 { "EditSave", CK_Save
},
78 { "EditLoad", CK_Load
},
79 { "EditNew", CK_New
},
80 { "EditSaveas", CK_Save_As
},
81 { "EditMark", CK_Mark
},
82 { "EditCopy", CK_Copy
},
83 { "EditMove", CK_Move
},
84 { "EditRemove", CK_Remove
},
85 { "EditUnmark", CK_Unmark
},
86 { "EditSaveBlock", CK_Save_Block
},
87 { "EditColumnMark", CK_Column_Mark
},
88 { "EditFind", CK_Find
},
89 { "EditFindAgain", CK_Find_Again
},
90 { "EditReplace", CK_Replace
},
91 { "EditReplaceAgain", CK_Replace_Again
},
92 { "EditCompleteWord", CK_Complete_Word
},
93 { "EditDebugStart", CK_Debug_Start
},
94 { "EditDebugStop", CK_Debug_Stop
},
95 { "EditDebugToggleBreak", CK_Debug_Toggle_Break
},
96 { "EditDebugClear", CK_Debug_Clear
},
97 { "EditDebugNext", CK_Debug_Next
},
98 { "EditDebugStep", CK_Debug_Step
},
99 { "EditDebugBackTrace", CK_Debug_Back_Trace
},
100 { "EditDebugContinue", CK_Debug_Continue
},
101 { "EditDebugEnterCommand", CK_Debug_Enter_Command
},
102 { "EditDebugUntilCurser", CK_Debug_Until_Curser
},
103 { "EditInsertFile", CK_Insert_File
},
104 { "EditExit", CK_Exit
},
105 { "EditToggleInsert", CK_Toggle_Insert
},
106 { "EditHelp", CK_Help
},
107 { "EditDate", CK_Date
},
108 { "EditRefresh", CK_Refresh
},
109 { "EditGoto", CK_Goto
},
110 { "EditDeleteLine", CK_Delete_Line
},
111 { "EditDeleteToLineEnd", CK_Delete_To_Line_End
},
112 { "EditDeleteToLineBegin", CK_Delete_To_Line_Begin
},
113 { "EditManPage", CK_Man_Page
},
114 { "EditSort", CK_Sort
},
115 { "EditMail", CK_Mail
},
116 { "EditCancel", CK_Cancel
},
117 { "EditComplete", CK_Complete
},
118 { "EditParagraphFormat", CK_Paragraph_Format
},
119 { "EditUtil", CK_Util
},
120 { "EditTypeLoadPython", CK_Type_Load_Python
},
121 { "EditFindFile", CK_Find_File
},
122 { "EditCtags", CK_Ctags
},
123 { "EditMatchBracket", CK_Match_Bracket
},
124 { "EditTerminal", CK_Terminal
},
125 { "EditTerminalApp", CK_Terminal_App
},
126 { "EditExtCmd", CK_ExtCmd
},
127 { "EditUserMenu", CK_User_Menu
},
128 { "EditSaveDesktop", CK_Save_Desktop
},
129 { "EditNewWindow", CK_New_Window
},
130 { "EditCycle", CK_Cycle
},
131 { "EditMenu", CK_Menu
},
132 { "EditSaveAndQuit", CK_Save_And_Quit
},
133 { "EditRunAnother", CK_Run_Another
},
134 { "EditCheckSaveAndQuit", CK_Check_Save_And_Quit
},
135 { "EditMaximize", CK_Maximize
},
136 { "EditBeginRecordMacro", CK_Begin_Record_Macro
},
137 { "EditEndRecordMacro", CK_End_Record_Macro
},
138 { "EditDeleteMacro", CK_Delete_Macro
},
139 { "EditToggleBookmark", CK_Toggle_Bookmark
},
140 { "EditFlushBookmarks", CK_Flush_Bookmarks
},
141 { "EditNextBookmark", CK_Next_Bookmark
},
142 { "EditPrevBookmark", CK_Prev_Bookmark
},
143 { "EditPageUpHighlight", CK_Page_Up_Highlight
},
144 { "EditPageDownHighlight", CK_Page_Down_Highlight
},
145 { "EditLeftHighlight", CK_Left_Highlight
},
146 { "EditRightHighlight", CK_Right_Highlight
},
147 { "EditWordLeftHighlight", CK_Word_Left_Highlight
},
148 { "EditWordRightHighlight", CK_Word_Right_Highlight
},
149 { "EditUpHighlight", CK_Up_Highlight
},
150 { "EditDownHighlight", CK_Down_Highlight
},
151 { "EditHomeHighlight", CK_Home_Highlight
},
152 { "EditEndHighlight", CK_End_Highlight
},
153 { "EditBeginningOfTextHighlight", CK_Beginning_Of_Text_Highlight
},
154 { "EditEndOfTextHighlight", CK_End_Of_Text_Highlight
},
155 { "EditBeginPageHighlight", CK_Begin_Page_Highlight
},
156 { "EditEndPageHighlight", CK_End_Page_Highlight
},
157 { "EditScrollUpHighlight", CK_Scroll_Up_Highlight
},
158 { "EditScrollDownHighlight", CK_Scroll_Down_Highlight
},
159 { "EditParagraphUpHighlight", CK_Paragraph_Up_Highlight
},
160 { "EditParagraphDownHighlight", CK_Paragraph_Down_Highlight
},
162 { "EditPageUpAltHighlight", CK_Page_Up_Alt_Highlight
},
163 { "EditPageDownAltHighlight", CK_Page_Down_Alt_Highlight
},
164 { "EditLeftAltHighlight", CK_Left_Alt_Highlight
},
165 { "EditRightAltHighlight", CK_Right_Alt_Highlight
},
166 { "EditWordLeftAltHighlight", CK_Word_Left_Alt_Highlight
},
167 { "EditWordRightAltHighlight", CK_Word_Right_Alt_Highlight
},
168 { "EditUpAltHighlight", CK_Up_Alt_Highlight
},
169 { "EditDownAltHighlight", CK_Down_Alt_Highlight
},
170 { "EditHomeAltHighlight", CK_Home_Alt_Highlight
},
171 { "EditEndAltHighlight", CK_End_Alt_Highlight
},
172 { "EditBeginningOfTextAltHighlight", CK_Beginning_Of_Text_Alt_Highlight
},
173 { "EditEndOfTextAltHighlight", CK_End_Of_Text_Alt_Highlight
},
174 { "EditBeginPageAltHighlight", CK_Begin_Page_Alt_Highlight
},
175 { "EditEndPageAltHighlight", CK_End_Page_Alt_Highlight
},
176 { "EditScrollUpAltHighlight", CK_Scroll_Up_Alt_Highlight
},
177 { "EditScrollDownAltHighlight", CK_Scroll_Down_Alt_Highlight
},
178 { "EditParagraphUpAltHighlight", CK_Paragraph_Up_Alt_Highlight
},
179 { "EditParagraphDownAltHighlight", CK_Paragraph_Down_Alt_Highlight
},
181 { "EditXStore", CK_XStore
},
182 { "EditXCut", CK_XCut
},
183 { "EditXPaste", CK_XPaste
},
184 { "EditSelectionHistory", CK_Selection_History
},
185 { "EditShell", CK_Shell
},
186 { "EditInsertLiteral", CK_Insert_Literal
},
187 { "EditExecuteMacro", CK_Execute_Macro
},
188 { "EditBeginorEndMacro", CK_Begin_End_Macro
},
189 { "EditExtmode", CK_Ext_Mode
},
190 { "EditToggleLineState", CK_Toggle_Line_State
},
192 { "EditFocusNext", CK_Focus_Next
},
193 { "EditFocusPrev", CK_Focus_Prev
},
194 { "EditHeightInc", CK_Height_Inc
},
195 { "EditHeightDec", CK_Height_Dec
},
196 { "EditMake", CK_Make
},
197 { "EditErrorNext", CK_Error_Next
},
198 { "EditErrorPrev", CK_Error_Prev
},
202 { "ViewSearch", CK_ViewSearch
},
203 { "ViewContinueSearch", CK_ViewContinueSearch
},
204 { "ViewGotoBookmark", CK_ViewGotoBookmark
},
205 { "ViewNewBookmark", CK_ViewNewBookmark
},
206 { "ViewMoveUp", CK_ViewMoveUp
},
207 { "ViewMoveDown", CK_ViewMoveDown
},
208 { "ViewMoveLeft", CK_ViewMoveLeft
},
209 { "ViewMoveRight", CK_ViewMoveRight
},
210 { "ViewMovePgDn", CK_ViewMovePgDn
},
211 { "ViewMovePgUp", CK_ViewMovePgUp
},
212 { "ViewMoveHalfPgDn", CK_ViewMoveHalfPgDn
},
213 { "ViewMoveHalfPgUp", CK_ViewMoveHalfPgUp
},
214 { "ViewMoveToBol", CK_ViewMoveToBol
},
215 { "ViewMoveToEol", CK_ViewMoveToEol
},
216 { "ViewNextFile", CK_ViewNextFile
},
217 { "ViewPrevFile", CK_ViewPrevFile
},
218 { "ViewToggleRuler", CK_ViewToggleRuler
},
219 { "HexViewToggleNavigationMode", CK_HexViewToggleNavigationMode
},
220 { "ViewQuit", CK_ViewQuit
},
223 { "CmdChmod", CK_ChmodCmd
},
224 { "CmdMenuLastSelected", CK_MenuLastSelectedCmd
},
225 { "CmdSingleDirsize", CK_SingleDirsizeCmd
},
226 { "CmdCopyCurrentPathname", CK_CopyCurrentPathname
},
227 { "CmdCopyOtherPathname", CK_CopyOtherPathname
},
228 { "CmdSuspend", CK_SuspendCmd
},
229 { "CmdToggleListing", CK_ToggleListingCmd
},
230 { "CmdChownAdvanced", CK_ChownAdvancedCmd
},
231 { "CmdChown", CK_ChownCmd
},
232 { "CmdCompareDirs", CK_CompareDirsCmd
},
233 { "CmdConfigureBox", CK_ConfigureBox
},
234 { "CmdConfigureVfs", CK_ConfigureVfs
},
235 { "CmdConfirmBox", CK_ConfirmBox
},
236 { "CmdCopy", CK_CopyCmd
},
237 { "CmdDelete", CK_DeleteCmd
},
238 { "CmdDirsizes", CK_DirsizesCmd
},
239 { "CmdDisplayBitsBox", CK_DisplayBitsBox
},
240 { "CmdEdit", CK_EditCmd
},
241 { "CmdEditMcMenu", CK_EditMcMenuCmd
},
242 { "CmdEditSymlink", CK_EditSymlinkCmd
},
243 { "CmdEditSyntax", CK_EditSyntaxCmd
},
244 { "CmdEditUserMenu", CK_EditUserMenuCmd
},
245 { "CmdExternalPanelize", CK_ExternalPanelize
},
246 { "CmdFilter", CK_FilterCmd
},
247 { "CmdFilteredView", CK_FilteredViewCmd
},
248 { "CmdFind", CK_FindCmd
},
249 { "CmdFishlink", CK_FishlinkCmd
},
250 { "CmdFtplink", CK_FtplinkCmd
},
251 { "CmdHistory", CK_HistoryCmd
},
252 { "CmdInfo", CK_InfoCmd
},
253 { "CmdJobs", CK_JobsCmd
},
254 { "CmdLayout", CK_LayoutCmd
},
255 { "CmdLearnKeys", CK_LearnKeys
},
256 { "CmdLink", CK_LinkCmd
},
257 { "CmdListing", CK_ListingCmd
},
258 { "CmdMkdir", CK_MkdirCmd
},
259 { "CmdQuickCd", CK_QuickCdCmd
},
260 { "CmdQuickChdir", CK_QuickChdirCmd
},
261 { "CmdQuickView", CK_QuickViewCmd
},
262 { "CmdQuietQuit", CK_QuietQuitCmd
},
263 { "CmdRename", CK_RenCmd
},
264 { "CmdReread", CK_RereadCmd
},
265 { "CmdReselectVfs", CK_ReselectVfs
},
266 { "CmdReverseSelection", CK_ReverseSelectionCmd
},
267 { "CmdSaveSetup", CK_SaveSetupCmd
},
268 { "CmdSelect", CK_SelectCmd
},
269 { "CmdSwapPanel", CK_SwapCmd
},
270 { "CmdSymlink", CK_SymlinkCmd
},
271 { "CmdTree", CK_TreeCmd
},
272 { "CmdUndelete", CK_UndeleteCmd
},
273 { "CmdUnselect", CK_UnselectCmd
},
274 { "CmdUserFileMenu", CK_UserFileMenuCmd
},
275 { "CmdView", CK_ViewCmd
},
276 { "CmdViewFile", CK_ViewFileCmd
},
277 { "CmdCopyCurrentReadlink", CK_CopyCurrentReadlink
},
278 { "CmdCopyOtherReadlink", CK_CopyOtherReadlink
},
279 { "CmdAddHotlist", CK_AddHotlist
},
280 { "CmdQuit", CK_QuitCmd
},
281 { "CmdCopyOtherTarget", CK_CopyOtherTarget
},
282 { "CmdToggleShowHidden", CK_ToggleShowHidden
},
285 { "PanelChdirOtherPanel", CK_PanelChdirOtherPanel
},
286 { "PanelChdirToReadlink", CK_PanelChdirToReadlink
},
287 { "PanelCopyLocal", CK_PanelCmdCopyLocal
},
288 { "PanelDeleteLocal", CK_PanelCmdDeleteLocal
},
289 { "PanelDoEnter", CK_PanelCmdDoEnter
},
290 { "PanelEditNew", CK_PanelCmdEditNew
},
291 { "PanelRenameLocal", CK_PanelCmdRenameLocal
},
292 { "PanelReverseSelection", CK_PanelCmdReverseSelection
},
293 { "PanelSelect", CK_PanelCmdSelect
},
294 { "PanelUnselect", CK_PanelCmdUnselect
},
295 { "PanelViewSimple", CK_PanelCmdViewSimple
},
296 { "PanelCtrlNextPage", CK_PanelCtrlNextPage
},
297 { "PanelCtrlPrevPage", CK_PanelCtrlPrevPage
},
298 { "PanelDirectoryHistoryList", CK_PanelDirectoryHistoryList
},
299 { "PanelDirectoryHistoryNext", CK_PanelDirectoryHistoryNext
},
300 { "PanelDirectoryHistoryPrev", CK_PanelDirectoryHistoryPrev
},
301 { "PanelGotoBottomFile", CK_PanelGotoBottomFile
},
302 { "PanelGotoMiddleFile", CK_PanelGotoMiddleFile
},
303 { "PanelGotoTopFile", CK_PanelGotoTopFile
},
304 { "PanelMarkFile", CK_PanelMarkFile
},
305 { "PanelMoveUp", CK_PanelMoveUp
},
306 { "PanelMoveDown", CK_PanelMoveDown
},
307 { "PanelMoveLeft", CK_PanelMoveLeft
},
308 { "PanelMoveRight", CK_PanelMoveRight
},
309 { "PanelMoveEnd", CK_PanelMoveEnd
},
310 { "PanelMoveHome", CK_PanelMoveHome
},
311 { "PanelNextPage", CK_PanelNextPage
},
312 { "PanelPrevPage", CK_PanelPrevPage
},
313 { "PanelSetPanelEncoding", CK_PanelSetPanelEncoding
},
314 { "PanelStartSearch", CK_PanelStartSearch
},
315 { "PanelSyncOtherPanel", CK_PanelSyncOtherPanel
},
318 { "InputBol", CK_InputBol
},
319 { "InputEol", CK_InputEol
},
320 { "InputMoveLeft", CK_InputMoveLeft
},
321 { "InputWordLeft", CK_InputWordLeft
},
322 { "InputBackwardChar", CK_InputBackwardChar
},
323 { "InputBackwardWord", CK_InputBackwardWord
},
324 { "InputMoveRight", CK_InputMoveRight
},
325 { "InputWordRight", CK_InputWordRight
},
326 { "InputForwardChar", CK_InputForwardChar
},
327 { "InputForwardWord", CK_InputForwardWord
},
328 { "InputBackwardDelete", CK_InputBackwardDelete
},
329 { "InputDeleteChar", CK_InputDeleteChar
},
330 { "InputKillWord", CK_InputKillWord
},
331 { "InputBackwardKillWord", CK_InputBackwardKillWord
},
332 { "InputSetMark", CK_InputSetMark
},
333 { "InputKillRegion", CK_InputKillRegion
},
334 { "InputKillSave", CK_InputKillSave
},
335 { "InputYank", CK_InputYank
},
336 { "InputKillLine", CK_InputKillLine
},
337 { "InputHistoryPrev", CK_InputHistoryPrev
},
338 { "InputHistoryNext", CK_InputHistoryNext
},
339 { "InputHistoryShow", CK_InputHistoryShow
},
340 { "InputComplete", CK_InputComplete
},
343 { "ExtMap1", CK_StartExtMap1
},
344 { "ExtMap2", CK_StartExtMap2
},
345 { "ShowCommandLine", CK_ShowCommandLine
},
346 { "SelectCodepage", CK_SelectCodepage
},
351 /*** global variables ****************************************************************************/
353 /* viewer/actions_cmd.c */
354 const global_key_map_t default_viewer_keymap
[] = {
356 { '?', CK_ViewSearch
},
357 { '/', CK_ViewSearch
},
358 { XCTRL('r'), CK_ViewContinueSearch
},
359 { XCTRL('s'), CK_ViewContinueSearch
},
360 { KEY_F (17), CK_ViewContinueSearch
},
361 { ALT('r'), CK_ViewToggleRuler
},
363 { KEY_HOME
, CK_ViewMoveToBol
},
364 { KEY_END
, CK_ViewMoveToEol
},
366 { 'h', CK_ViewMoveLeft
},
367 { KEY_LEFT
, CK_ViewMoveLeft
},
369 { 'l', CK_ViewMoveRight
},
370 { KEY_RIGHT
, CK_ViewMoveRight
},
372 { 'k', CK_ViewMoveUp
},
373 { 'y', CK_ViewMoveUp
},
374 { KEY_IC
, CK_ViewMoveUp
},
375 { KEY_UP
, CK_ViewMoveUp
},
377 { 'j', CK_ViewMoveDown
},
378 { 'e', CK_ViewMoveDown
},
379 { KEY_DOWN
, CK_ViewMoveDown
},
380 { KEY_DC
, CK_ViewMoveDown
},
382 { ' ', CK_ViewMovePgDn
},
383 { 'f', CK_ViewMovePgDn
},
384 { KEY_NPAGE
, CK_ViewMovePgDn
},
386 { 'b', CK_ViewMovePgUp
},
387 { KEY_PPAGE
, CK_ViewMovePgUp
},
389 { 'd', CK_ViewMoveHalfPgDn
},
390 { 'u', CK_ViewMoveHalfPgUp
},
392 { 'm', CK_ViewGotoBookmark
},
393 { 'r', CK_ViewNewBookmark
},
395 { XCTRL ('f'), CK_ViewNextFile
},
396 { XCTRL ('b'), CK_ViewPrevFile
},
398 { 'q', CK_ViewQuit
},
399 { XCTRL ('g'), CK_ViewQuit
},
400 { ESC_CHAR
, CK_ViewQuit
},
402 { XCTRL ('t'), CK_SelectCodepage
},
403 { XCTRL('o'), CK_ShowCommandLine
},
407 const global_key_map_t default_viewer_hex_keymap
[] = {
409 { '\t', CK_HexViewToggleNavigationMode
},
410 { XCTRL ('a'), CK_ViewMoveToBol
},
411 { XCTRL ('e'), CK_ViewMoveToEol
},
413 { 'b', CK_ViewMoveLeft
},
414 { KEY_LEFT
, CK_ViewMoveLeft
},
416 { 'f', CK_ViewMoveRight
},
417 { KEY_RIGHT
, CK_ViewMoveRight
},
419 { 'k', CK_ViewMoveUp
},
420 { 'y', CK_ViewMoveUp
},
421 { KEY_UP
, CK_ViewMoveUp
},
423 { 'j', CK_ViewMoveDown
},
424 { KEY_DOWN
, CK_ViewMoveDown
},
425 { KEY_DC
, CK_ViewMoveDown
},
430 /* ../edit/editkeys.c */
431 const global_key_map_t default_editor_keymap
[] = {
435 { ESC_CHAR
, CK_Exit
},
436 { KEY_BACKSPACE
, CK_BackSpace
},
437 { KEY_DC
, CK_Delete
},
438 { KEY_DOWN
, CK_Down
},
440 { KEY_HOME
, CK_Home
},
441 { KEY_IC
, CK_Toggle_Insert
},
442 { KEY_LEFT
, CK_Left
},
443 { KEY_NPAGE
, CK_Page_Down
},
444 { KEY_PPAGE
, CK_Page_Up
},
445 { KEY_RIGHT
, CK_Right
},
448 { ALT ('\n'), CK_Find_Definition
},
449 { ALT ('\t'), CK_Complete_Word
},
450 { ALT ('l'), CK_Goto
},
451 { ALT ('L'), CK_Goto
},
452 { ALT ('p'), CK_Paragraph_Format
},
453 { ALT ('t'), CK_Sort
},
454 { ALT ('u'), CK_ExtCmd
},
455 { ALT ('<'), CK_Beginning_Of_Text
},
456 { ALT ('>'), CK_End_Of_Text
},
457 { ALT ('-'), CK_Load_Prev_File
},
458 { ALT ('='), CK_Load_Next_File
},
459 { ALT ('d'), CK_Delete_Word_Right
},
460 { ALT (KEY_BACKSPACE
), CK_Delete_Word_Left
},
461 { ALT ('n'), CK_Toggle_Line_State
},
462 { ALT ('_'), CK_Toggle_Tab_TWS
},
463 { ALT ('k'), CK_Toggle_Bookmark
},
464 { ALT ('i'), CK_Prev_Bookmark
},
465 { ALT ('j'), CK_Next_Bookmark
},
466 { ALT ('o'), CK_Flush_Bookmarks
},
468 { XCTRL ('k'), CK_Delete_To_Line_End
},
469 { XCTRL ('l'), CK_Refresh
},
470 { XCTRL ('o'), CK_Shell
},
471 { XCTRL ('s'), CK_Toggle_Syntax
},
472 { XCTRL ('u'), CK_Undo
},
473 { XCTRL ('t'), CK_SelectCodepage
},
474 { XCTRL ('q'), CK_Insert_Literal
},
475 { XCTRL ('a'), CK_Execute_Macro
},
476 { XCTRL ('r'), CK_Begin_End_Macro
},
478 { KEY_F (1), CK_Help
},
479 { KEY_F (2), CK_Save
},
480 { KEY_F (3), CK_Mark
},
481 { KEY_F (4), CK_Replace
},
482 { KEY_F (5), CK_Copy
},
483 { KEY_F (6), CK_Move
},
484 { KEY_F (7), CK_Find
},
485 { KEY_F (8), CK_Remove
},
486 { KEY_F (10), CK_Exit
},
488 { KEY_F (11), CK_User_Menu
},
489 { KEY_F (12), CK_Save_As
},
490 { KEY_F (13), CK_Column_Mark
},
491 { KEY_F (14), CK_Replace_Again
},
492 { KEY_F (15), CK_Insert_File
},
493 { KEY_F (17), CK_Find_Again
},
495 { KEY_F (19), CK_Pipe_Block (0) },
498 { KEY_M_SHIFT
| KEY_PPAGE
, CK_Page_Up_Highlight
},
499 { KEY_M_SHIFT
| KEY_NPAGE
, CK_Page_Down_Highlight
},
500 { KEY_M_SHIFT
| KEY_LEFT
, CK_Left_Highlight
},
501 { KEY_M_SHIFT
| KEY_RIGHT
, CK_Right_Highlight
},
502 { KEY_M_SHIFT
| KEY_UP
, CK_Up_Highlight
},
503 { KEY_M_SHIFT
| KEY_DOWN
, CK_Down_Highlight
},
504 { KEY_M_SHIFT
| KEY_HOME
, CK_Home_Highlight
},
505 { KEY_M_SHIFT
| KEY_END
, CK_End_Highlight
},
506 { KEY_M_SHIFT
| KEY_IC
, CK_XPaste
},
507 { KEY_M_SHIFT
| KEY_DC
, CK_XCut
},
508 /* useful for pasting multiline text */
509 { KEY_M_SHIFT
| '\n', CK_Return
},
512 { KEY_M_ALT
| KEY_PPAGE
, CK_Page_Up_Alt_Highlight
},
513 { KEY_M_ALT
| KEY_NPAGE
, CK_Page_Down_Alt_Highlight
},
514 { KEY_M_ALT
| KEY_LEFT
, CK_Left_Alt_Highlight
},
515 { KEY_M_ALT
| KEY_RIGHT
, CK_Right_Alt_Highlight
},
516 { KEY_M_ALT
| KEY_UP
, CK_Up_Alt_Highlight
},
517 { KEY_M_ALT
| KEY_DOWN
, CK_Down_Alt_Highlight
},
518 { KEY_M_ALT
| KEY_HOME
, CK_Home_Highlight
},
519 { KEY_M_ALT
| KEY_END
, CK_End_Alt_Highlight
},
522 { KEY_M_CTRL
| (KEY_F (2)), CK_Save_As
},
523 { KEY_M_CTRL
| (KEY_F (4)), CK_Replace_Again
},
524 { KEY_M_CTRL
| (KEY_F (7)), CK_Find_Again
},
525 { KEY_M_CTRL
| KEY_BACKSPACE
, CK_Undo
},
526 { KEY_M_CTRL
| KEY_PPAGE
, CK_Beginning_Of_Text
},
527 { KEY_M_CTRL
| KEY_NPAGE
, CK_End_Of_Text
},
528 { KEY_M_CTRL
| KEY_HOME
, CK_Beginning_Of_Text
},
529 { KEY_M_CTRL
| KEY_END
, CK_End_Of_Text
},
530 { KEY_M_CTRL
| KEY_UP
, CK_Scroll_Up
},
531 { KEY_M_CTRL
| KEY_DOWN
, CK_Scroll_Down
},
532 { KEY_M_CTRL
| KEY_LEFT
, CK_Word_Left
},
533 { KEY_M_CTRL
| KEY_RIGHT
, CK_Word_Right
},
534 { KEY_M_CTRL
| KEY_IC
, CK_XStore
},
535 { KEY_M_CTRL
| KEY_DC
, CK_Remove
},
538 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_PPAGE
, CK_Beginning_Of_Text_Highlight
},
539 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_NPAGE
, CK_End_Of_Text_Highlight
},
540 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_LEFT
, CK_Word_Left_Highlight
},
541 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_RIGHT
, CK_Word_Right_Highlight
},
542 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_UP
, CK_Scroll_Up_Highlight
},
543 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_DOWN
, CK_Scroll_Down_Highlight
},
545 { XCTRL ('x'), CK_StartExtMap1
},
551 const global_key_map_t default_panel_keymap
[] = {
553 { ALT('o'), CK_PanelChdirOtherPanel
},
554 { ALT('l'), CK_PanelChdirToReadlink
},
555 { KEY_F(15), CK_PanelCmdCopyLocal
},
556 { KEY_F(18), CK_PanelCmdDeleteLocal
},
557 { KEY_ENTER
, CK_PanelCmdDoEnter
},
558 { '\n', CK_PanelCmdDoEnter
},
559 { KEY_F(14), CK_PanelCmdEditNew
},
560 { KEY_F(16), CK_PanelCmdRenameLocal
},
561 { ALT('*'), CK_PanelCmdReverseSelection
},
562 { KEY_KP_ADD
, CK_PanelCmdSelect
},
563 { KEY_KP_SUBTRACT
, CK_PanelCmdUnselect
},
564 { KEY_F(13), CK_PanelCmdViewSimple
},
565 { KEY_M_CTRL
| KEY_NPAGE
, CK_PanelCtrlNextPage
},
566 { KEY_M_CTRL
| KEY_PPAGE
, CK_PanelCtrlPrevPage
},
567 { ALT('H'), CK_PanelDirectoryHistoryList
},
568 { ALT('u'), CK_PanelDirectoryHistoryNext
},
569 { ALT('y'), CK_PanelDirectoryHistoryPrev
},
570 { ALT('j'), CK_PanelGotoBottomFile
},
571 { ALT('r'), CK_PanelGotoMiddleFile
},
572 { ALT('g'), CK_PanelGotoTopFile
},
573 { KEY_IC
, CK_PanelMarkFile
},
574 { KEY_UP
, CK_PanelMoveUp
},
575 { KEY_DOWN
, CK_PanelMoveDown
},
576 { KEY_LEFT
, CK_PanelMoveLeft
},
577 { KEY_RIGHT
, CK_PanelMoveRight
},
578 { KEY_END
, CK_PanelMoveEnd
},
579 { KEY_HOME
, CK_PanelMoveHome
},
580 { KEY_A1
, CK_PanelMoveHome
},
581 { KEY_NPAGE
, CK_PanelNextPage
},
582 { KEY_PPAGE
, CK_PanelPrevPage
},
583 { XCTRL('t'), CK_PanelSetPanelEncoding
},
584 { XCTRL('s'), CK_PanelStartSearch
},
585 { ALT('i'), CK_PanelSyncOtherPanel
},
590 const global_key_map_t default_main_map
[] = {
591 {KEY_F (19), CK_MenuLastSelectedCmd
},
592 {KEY_F (20), CK_QuietQuitCmd
},
593 {XCTRL ('@'), CK_SingleDirsizeCmd
},
594 /* Copy useful information to the command line */
595 {ALT ('a'), CK_CopyCurrentPathname
},
596 {ALT ('A'), CK_CopyOtherPathname
},
597 {ALT ('c'), CK_QuickCdCmd
},
598 /* To access the directory hotlist */
599 {XCTRL ('\\'), CK_QuickChdirCmd
},
601 {XCTRL ('z'), CK_SuspendCmd
},
602 /* The filtered view command */
603 {ALT ('!'), CK_FilteredViewCmd
},
605 {ALT ('?'), CK_FindCmd
},
607 {XCTRL ('r'), CK_RereadCmd
},
608 /* Toggle listing between long, user defined and full formats */
609 {ALT ('t'), CK_ToggleListingCmd
},
611 {XCTRL ('u'), CK_SwapCmd
},
613 {XCTRL ('o'), CK_ShowCommandLine
},
614 {ALT ('.'), CK_ToggleShowHidden
},
615 {XCTRL ('x'), CK_StartExtMap1
},
619 const global_key_map_t default_main_x_map
[] = {
620 {XCTRL ('c'), CK_QuitCmd
},
621 {'d', CK_CompareDirsCmd
},
623 {'a', CK_ReselectVfs
},
625 {'p', CK_CopyCurrentPathname
},
626 {XCTRL ('p'), CK_CopyOtherPathname
},
627 {'t', CK_CopyCurrentTagged
},
628 {XCTRL ('t'), CK_CopyOtherTarget
},
631 {'r', CK_CopyCurrentReadlink
},
632 {XCTRL ('r'), CK_CopyOtherReadlink
},
634 {'s', CK_SymlinkCmd
},
635 {XCTRL ('s'), CK_EditSymlinkCmd
},
637 {'q', CK_QuickViewCmd
},
638 {'h', CK_AddHotlist
},
639 {'!', CK_ExternalPanelize
},
640 #ifdef WITH_BACKGROUND
642 #endif /* WITH_BACKGROUND */
646 const global_key_map_t default_input_keymap
[] = {
648 { XCTRL('a'), CK_InputBol
},
649 { KEY_HOME
, CK_InputBol
},
650 { KEY_A1
, CK_InputBol
},
651 { ALT ('<'), CK_InputBol
},
652 { XCTRL('e'), CK_InputEol
},
653 { KEY_END
, CK_InputEol
},
654 { KEY_C1
, CK_InputEol
},
655 { ALT ('>'), CK_InputEol
},
656 { KEY_LEFT
, CK_InputMoveLeft
},
657 { KEY_LEFT
| KEY_M_CTRL
, CK_InputWordLeft
},
658 { KEY_RIGHT
, CK_InputMoveRight
},
659 { KEY_RIGHT
| KEY_M_CTRL
, CK_InputWordRight
},
661 { XCTRL('b'), CK_InputBackwardChar
},
662 { ALT('b'), CK_InputBackwardWord
},
663 { XCTRL('f'), CK_InputForwardChar
},
664 { ALT('f'), CK_InputForwardWord
},
667 { KEY_BACKSPACE
, CK_InputBackwardDelete
},
668 { KEY_DC
, CK_InputDeleteChar
},
669 { ALT('d'), CK_InputKillWord
},
670 { ALT(KEY_BACKSPACE
), CK_InputBackwardKillWord
},
672 /* Region manipulation */
673 { XCTRL('w'), CK_InputKillRegion
},
674 { ALT('w'), CK_InputKillSave
},
675 { XCTRL('y'), CK_InputYank
},
676 { XCTRL('k'), CK_InputKillLine
},
679 { ALT('p'), CK_InputHistoryPrev
},
680 { ALT('n'), CK_InputHistoryNext
},
681 { ALT('h'), CK_InputHistoryShow
},
684 { ALT('\t'), CK_InputComplete
},
689 int lookup_action (char *keyname
)
693 for (i
= 0; command_names
[i
].name
; i
++){
694 if (!str_casecmp (command_names
[i
].name
, keyname
))
695 return command_names
[i
].val
;
701 keymap_add(GArray
*keymap
, int key
, int cmd
)
703 global_key_map_t new_bind
, *map
;
704 map
= &(g_array_index(keymap
, global_key_map_t
, 0));
706 if (key
!=0 && cmd
!=0) {
708 new_bind
.command
= cmd
;
709 g_array_append_val(keymap
, new_bind
);
715 keybind_cmd_bind(GArray
*keymap
, char *keybind
, int action
)
717 keymap_add(keymap
, lookup_key(keybind
), action
);