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>
37 #include "lib/global.h"
38 #include "lib/tty/win.h"
39 #include "lib/tty/key.h" /* KEY_M_ */
40 #include "lib/tty/tty.h" /* keys */
41 #include "lib/strutil.h"
43 #include "cmddef.h" /* CK_ cmd name const */
47 static name_keymap_t command_names
[] = {
48 #ifdef USE_INTERNAL_EDIT
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 { "EditMenu", CK_Menu
},
78 { "EditSave", CK_Save
},
79 { "EditLoad", CK_Load
},
80 { "EditNew", CK_New
},
81 { "EditSaveas", CK_Save_As
},
82 { "EditMark", CK_Mark
},
83 { "EditCopy", CK_Copy
},
84 { "EditMove", CK_Move
},
85 { "EditRemove", CK_Remove
},
86 { "EditMarkAll", CK_Mark_All
},
87 { "EditUnmark", CK_Unmark
},
88 { "EditSaveBlock", CK_Save_Block
},
89 { "EditColumnMark", CK_Column_Mark
},
90 { "EditFind", CK_Find
},
91 { "EditFindAgain", CK_Find_Again
},
92 { "EditReplace", CK_Replace
},
93 { "EditReplaceAgain", CK_Replace_Again
},
94 { "EditCompleteWord", CK_Complete_Word
},
97 { "EditDebugStart", CK_Debug_Start
},
98 { "EditDebugStop", CK_Debug_Stop
},
99 { "EditDebugToggleBreak", CK_Debug_Toggle_Break
},
100 { "EditDebugClear", CK_Debug_Clear
},
101 { "EditDebugNext", CK_Debug_Next
},
102 { "EditDebugStep", CK_Debug_Step
},
103 { "EditDebugBackTrace", CK_Debug_Back_Trace
},
104 { "EditDebugContinue", CK_Debug_Continue
},
105 { "EditDebugEnterCommand", CK_Debug_Enter_Command
},
106 { "EditDebugUntilCurser", CK_Debug_Until_Curser
},
108 { "EditInsertFile", CK_Insert_File
},
109 { "EditQuit", CK_Quit
},
110 { "EditToggleInsert", CK_Toggle_Insert
},
111 { "EditHelp", CK_Help
},
112 { "EditDate", CK_Date
},
113 { "EditRefresh", CK_Refresh
},
114 { "EditGoto", CK_Goto
},
115 { "EditDeleteLine", CK_Delete_Line
},
116 { "EditDeleteToLineEnd", CK_Delete_To_Line_End
},
117 { "EditDeleteToLineBegin", CK_Delete_To_Line_Begin
},
118 { "EditManPage", CK_Man_Page
},
119 { "EditSort", CK_Sort
},
120 { "EditMail", CK_Mail
},
121 { "EditCancel", CK_Cancel
},
122 { "EditComplete", CK_Complete
},
123 { "EditParagraphFormat", CK_Paragraph_Format
},
124 { "EditUtil", CK_Util
},
125 { "EditTypeLoadPython", CK_Type_Load_Python
},
126 { "EditFindFile", CK_Find_File
},
127 { "EditCtags", CK_Ctags
},
128 { "EditMatchBracket", CK_Match_Bracket
},
129 { "EditTerminal", CK_Terminal
},
130 { "EditTerminalApp", CK_Terminal_App
},
131 { "EditExtCmd", CK_ExtCmd
},
132 { "EditUserMenu", CK_User_Menu
},
133 { "EditBeginRecordMacro", CK_Begin_Record_Macro
},
134 { "EditEndRecordMacro", CK_End_Record_Macro
},
135 { "EditDeleteMacro", CK_Delete_Macro
},
136 { "EditToggleBookmark", CK_Toggle_Bookmark
},
137 { "EditFlushBookmarks", CK_Flush_Bookmarks
},
138 { "EditNextBookmark", CK_Next_Bookmark
},
139 { "EditPrevBookmark", CK_Prev_Bookmark
},
140 { "EditPageUpHighlight", CK_Page_Up_Highlight
},
141 { "EditPageDownHighlight", CK_Page_Down_Highlight
},
142 { "EditLeftHighlight", CK_Left_Highlight
},
143 { "EditRightHighlight", CK_Right_Highlight
},
144 { "EditWordLeftHighlight", CK_Word_Left_Highlight
},
145 { "EditWordRightHighlight", CK_Word_Right_Highlight
},
146 { "EditUpHighlight", CK_Up_Highlight
},
147 { "EditDownHighlight", CK_Down_Highlight
},
148 { "EditHomeHighlight", CK_Home_Highlight
},
149 { "EditEndHighlight", CK_End_Highlight
},
150 { "EditBeginningOfTextHighlight", CK_Beginning_Of_Text_Highlight
},
151 { "EditEndOfTextHighlight", CK_End_Of_Text_Highlight
},
152 { "EditBeginPageHighlight", CK_Begin_Page_Highlight
},
153 { "EditEndPageHighlight", CK_End_Page_Highlight
},
154 { "EditScrollUpHighlight", CK_Scroll_Up_Highlight
},
155 { "EditScrollDownHighlight", CK_Scroll_Down_Highlight
},
156 { "EditParagraphUpHighlight", CK_Paragraph_Up_Highlight
},
157 { "EditParagraphDownHighlight", CK_Paragraph_Down_Highlight
},
159 { "EditPageUpAltHighlight", CK_Page_Up_Alt_Highlight
},
160 { "EditPageDownAltHighlight", CK_Page_Down_Alt_Highlight
},
161 { "EditLeftAltHighlight", CK_Left_Alt_Highlight
},
162 { "EditRightAltHighlight", CK_Right_Alt_Highlight
},
163 { "EditWordLeftAltHighlight", CK_Word_Left_Alt_Highlight
},
164 { "EditWordRightAltHighlight", CK_Word_Right_Alt_Highlight
},
165 { "EditUpAltHighlight", CK_Up_Alt_Highlight
},
166 { "EditDownAltHighlight", CK_Down_Alt_Highlight
},
167 { "EditHomeAltHighlight", CK_Home_Alt_Highlight
},
168 { "EditEndAltHighlight", CK_End_Alt_Highlight
},
169 { "EditBeginningOfTextAltHighlight", CK_Beginning_Of_Text_Alt_Highlight
},
170 { "EditEndOfTextAltHighlight", CK_End_Of_Text_Alt_Highlight
},
171 { "EditBeginPageAltHighlight", CK_Begin_Page_Alt_Highlight
},
172 { "EditEndPageAltHighlight", CK_End_Page_Alt_Highlight
},
173 { "EditScrollUpAltHighlight", CK_Scroll_Up_Alt_Highlight
},
174 { "EditScrollDownAltHighlight", CK_Scroll_Down_Alt_Highlight
},
175 { "EditParagraphUpAltHighlight", CK_Paragraph_Up_Alt_Highlight
},
176 { "EditParagraphDownAltHighlight", CK_Paragraph_Down_Alt_Highlight
},
178 { "EditShiftBlockLeft", CK_Shift_Block_Left
},
179 { "EditShiftBlockRight", CK_Shift_Block_Right
},
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
},
191 { "EditToggleTabTWS", CK_Toggle_Tab_TWS
},
192 { "EditToggleSyntax", CK_Toggle_Syntax
},
193 { "EditToggleShowMargin", CK_Toggle_Show_Margin
},
194 { "EditFindDefinition", CK_Find_Definition
},
195 { "EditLoadPrevFile", CK_Load_Prev_File
},
196 { "EditLoadNextFile", CK_Load_Next_File
},
197 { "EditOptions", CK_Edit_Options
},
198 { "EditSaveMode", CK_Edit_Save_Mode
},
199 { "EditChooseSyntax", CK_Choose_Syntax
},
200 { "EditAbout", CK_About
},
203 { "EditFocusNext", CK_Focus_Next
},
204 { "EditFocusPrev", CK_Focus_Prev
},
205 { "EditHeightInc", CK_Height_Inc
},
206 { "EditHeightDec", CK_Height_Dec
},
207 { "EditMake", CK_Make
},
208 { "EditErrorNext", CK_Error_Next
},
209 { "EditErrorPrev", CK_Error_Prev
},
213 { "EditSaveDesktop", CK_Save_Desktop
},
214 { "EditNewWindow", CK_New_Window
},
215 { "EditCycle", CK_Cycle
},
216 { "EditSaveAndQuit", CK_Save_And_Quit
},
217 { "EditRunAnother", CK_Run_Another
},
218 { "EditCheckSaveAndQuit", CK_Check_Save_And_Quit
},
219 { "EditMaximize", CK_Maximize
},
222 #endif /* USE_INTERNAL_EDIT */
225 { "ViewHelp", CK_ViewHelp
},
226 { "ViewToggleWrapMode", CK_ViewToggleWrapMode
},
227 { "ViewToggleHexEditMode", CK_ViewToggleHexEditMode
},
228 { "ViewQuit", CK_ViewQuit
},
229 { "ViewToggleHexMode", CK_ViewToggleHexMode
},
230 { "ViewGoto", CK_ViewGoto
},
231 { "ViewHexEditSave", CK_ViewHexEditSave
},
232 { "ViewSearch", CK_ViewSearch
},
233 { "ViewToggleMagicMode", CK_ViewToggleMagicMode
},
234 { "ViewToggleNroffMode", CK_ViewToggleNroffMode
},
235 { "ViewContinueSearch", CK_ViewContinueSearch
},
236 { "ViewGotoBookmark", CK_ViewGotoBookmark
},
237 { "ViewNewBookmark", CK_ViewNewBookmark
},
238 { "ViewMoveUp", CK_ViewMoveUp
},
239 { "ViewMoveDown", CK_ViewMoveDown
},
240 { "ViewMoveLeft", CK_ViewMoveLeft
},
241 { "ViewMoveRight", CK_ViewMoveRight
},
242 { "ViewMovePgDn", CK_ViewMovePgDn
},
243 { "ViewMovePgUp", CK_ViewMovePgUp
},
244 { "ViewMoveHalfPgDn", CK_ViewMoveHalfPgDn
},
245 { "ViewMoveHalfPgUp", CK_ViewMoveHalfPgUp
},
246 { "ViewMoveToBol", CK_ViewMoveToBol
},
247 { "ViewMoveToEol", CK_ViewMoveToEol
},
248 { "ViewNextFile", CK_ViewNextFile
},
249 { "ViewPrevFile", CK_ViewPrevFile
},
250 { "ViewToggleRuler", CK_ViewToggleRuler
},
251 { "ViewToggleHexNavMode", CK_ViewToggleHexNavMode
},
254 { "HelpHelp", CK_HelpHelp
},
255 { "HelpIndex", CK_HelpIndex
},
256 { "HelpBack", CK_HelpBack
},
257 { "HelpQuit", CK_HelpQuit
},
258 { "HelpMoveUp", CK_HelpMoveUp
},
259 { "HelpMoveDown", CK_HelpMoveDown
},
260 { "HelpSelectLink", CK_HelpSelectLink
},
261 { "HelpNextLink", CK_HelpNextLink
},
262 { "HelpPrevLink", CK_HelpPrevLink
},
263 { "HelpNextNode", CK_HelpNextNode
},
264 { "HelpPrevNode", CK_HelpPrevNode
},
267 { "TreeHelp", CK_TreeHelp
},
268 { "TreeForget", CK_TreeForget
},
269 { "TreeToggleNav", CK_TreeToggleNav
},
270 { "TreeCopy", CK_TreeCopy
},
271 { "TreeMove", CK_TreeMove
},
272 { "TreeMake", CK_TreeMake
},
273 { "TreeMoveUp", CK_TreeMoveUp
},
274 { "TreeMoveDown", CK_TreeMoveDown
},
275 { "TreeMoveLeft", CK_TreeMoveLeft
},
276 { "TreeMoveRight", CK_TreeMoveRight
},
277 { "TreeMoveHome", CK_TreeMoveHome
},
278 { "TreeMoveEnd", CK_TreeMoveEnd
},
279 { "TreeMovePgUp", CK_TreeMovePgUp
},
280 { "TreeMovePgDn", CK_TreeMovePgDn
},
281 { "TreeOpen", CK_TreeOpen
},
282 { "TreeRescan", CK_TreeRescan
},
283 { "TreeStartSearch", CK_TreeStartSearch
},
284 { "TreeRemove", CK_TreeRemove
},
287 { "CmdHelp", CK_HelpCmd
},
288 { "CmdMenu", CK_MenuCmd
},
289 { "CmdChmod", CK_ChmodCmd
},
290 { "CmdMenuLastSelected", CK_MenuLastSelectedCmd
},
291 { "CmdSingleDirsize", CK_SingleDirsizeCmd
},
292 { "CmdCopyCurrentPathname", CK_CopyCurrentPathname
},
293 { "CmdCopyOtherPathname", CK_CopyOtherPathname
},
294 { "CmdSuspend", CK_SuspendCmd
},
295 { "CmdToggleListing", CK_ToggleListingCmd
},
296 { "CmdChownAdvanced", CK_ChownAdvancedCmd
},
297 { "CmdChown", CK_ChownCmd
},
298 { "CmdCompareDirs", CK_CompareDirsCmd
},
299 { "CmdConfigureBox", CK_ConfigureBox
},
300 { "CmdConfigureVfs", CK_ConfigureVfs
},
301 { "CmdConfirmBox", CK_ConfirmBox
},
302 { "CmdCopy", CK_CopyCmd
},
303 { "CmdDelete", CK_DeleteCmd
},
304 { "CmdDirsizes", CK_DirsizesCmd
},
305 { "CmdDisplayBitsBox", CK_DisplayBitsBox
},
306 { "CmdEdit", CK_EditCmd
},
307 { "CmdEditExtFile", CK_EditExtFileCmd
},
308 { "CmdEditFhlFile", CK_EditFhlFileCmd
},
309 { "CmdEditMcMenu", CK_EditMcMenuCmd
},
310 { "CmdEditSymlink", CK_EditSymlinkCmd
},
311 { "CmdEditSyntax", CK_EditSyntaxCmd
},
312 { "CmdEditUserMenu", CK_EditUserMenuCmd
},
313 { "CmdExternalPanelize", CK_ExternalPanelize
},
314 { "CmdFilter", CK_FilterCmd
},
315 { "CmdFilteredView", CK_FilteredViewCmd
},
316 { "CmdFind", CK_FindCmd
},
318 { "CmdFishlink", CK_FishlinkCmd
},
319 { "CmdFtplink", CK_FtplinkCmd
},
321 { "CmdHistory", CK_HistoryCmd
},
322 { "CmdInfo", CK_InfoCmd
},
323 #ifdef WITH_BACKGROUND
324 { "CmdJobs", CK_JobsCmd
},
326 { "CmdLayout", CK_LayoutCmd
},
327 { "CmdLearnKeys", CK_LearnKeys
},
328 { "CmdLink", CK_LinkCmd
},
329 { "CmdListing", CK_ListingCmd
},
330 #ifdef LISTMODE_EDITOR
331 { "CmdListmodeCmd", CK_ListmodeCmd
}.
333 { "CmdMkdir", CK_MkdirCmd
},
334 #if defined (USE_NETCODE) && defined (ENABLE_VFS_MCFS)
335 { "CmdNetlink", CK_NetlinkCmd
},
337 { "CmdQuickCd", CK_QuickCdCmd
},
338 { "CmdQuickChdir", CK_QuickChdirCmd
},
339 { "CmdQuickView", CK_QuickViewCmd
},
340 { "CmdQuietQuit", CK_QuietQuitCmd
},
341 { "CmdRename", CK_RenameCmd
},
342 { "CmdReread", CK_RereadCmd
},
343 { "CmdReselectVfs", CK_ReselectVfs
},
344 { "CmdReverseSelection", CK_ReverseSelectionCmd
},
345 { "CmdSaveSetup", CK_SaveSetupCmd
},
346 { "CmdSelect", CK_SelectCmd
},
347 #if defined (USE_NETCODE) && defined (ENABLE_VFS_SMB)
348 { "CmdSmblinkCmd", CK_SmblinkCmd
},
349 #endif /* USE_NETCODE || ENABLE_VFS_SMB */
350 { "CmdSwapPanel", CK_SwapCmd
},
351 { "CmdSymlink", CK_SymlinkCmd
},
352 { "CmdTree", CK_TreeCmd
},
353 { "CmdTreeBox", CK_TreeBoxCmd
},
355 { "CmdUndelete", CK_UndeleteCmd
},
357 { "CmdUnselect", CK_UnselectCmd
},
358 { "CmdUserMenu", CK_UserMenuCmd
},
359 { "CmdUserFileMenu", CK_UserFileMenuCmd
},
360 { "CmdView", CK_ViewCmd
},
361 { "CmdViewFile", CK_ViewFileCmd
},
362 { "CmdCopyCurrentReadlink", CK_CopyCurrentReadlink
},
363 { "CmdCopyOtherReadlink", CK_CopyOtherReadlink
},
364 { "CmdAddHotlist", CK_AddHotlist
},
365 { "CmdQuit", CK_QuitCmd
},
366 { "CmdCopyCurrentTagged", CK_CopyCurrentTagged
},
367 { "CmdCopyOtherTagged", CK_CopyOtherTagged
},
368 { "CmdToggleShowHidden", CK_ToggleShowHidden
},
369 { "CmdTogglePanelsSplit", CK_TogglePanelsSplit
},
372 { "PanelChdirOtherPanel", CK_PanelChdirOtherPanel
},
373 { "PanelChdirToReadlink", CK_PanelChdirToReadlink
},
374 { "PanelCopyLocal", CK_PanelCmdCopyLocal
},
375 { "PanelDeleteLocal", CK_PanelCmdDeleteLocal
},
376 { "PanelDoEnter", CK_PanelCmdDoEnter
},
377 { "PanelEditNew", CK_PanelCmdEditNew
},
378 { "PanelRenameLocal", CK_PanelCmdRenameLocal
},
379 { "PanelReverseSelection", CK_PanelCmdReverseSelection
},
380 { "PanelSelect", CK_PanelCmdSelect
},
381 { "PanelUnselect", CK_PanelCmdUnselect
},
382 { "PanelViewSimple", CK_PanelCmdViewSimple
},
383 { "PanelCtrlNextPage", CK_PanelCtrlNextPage
},
384 { "PanelCtrlPrevPage", CK_PanelCtrlPrevPage
},
385 { "PanelDirectoryHistoryList", CK_PanelDirectoryHistoryList
},
386 { "PanelDirectoryHistoryNext", CK_PanelDirectoryHistoryNext
},
387 { "PanelDirectoryHistoryPrev", CK_PanelDirectoryHistoryPrev
},
388 { "PanelGotoBottomFile", CK_PanelGotoBottomFile
},
389 { "PanelGotoMiddleFile", CK_PanelGotoMiddleFile
},
390 { "PanelGotoTopFile", CK_PanelGotoTopFile
},
391 { "PanelMarkFile", CK_PanelMarkFile
},
392 { "PanelMoveUp", CK_PanelMoveUp
},
393 { "PanelMoveDown", CK_PanelMoveDown
},
394 { "PanelMoveLeft", CK_PanelMoveLeft
},
395 { "PanelMoveRight", CK_PanelMoveRight
},
396 { "PanelMoveEnd", CK_PanelMoveEnd
},
397 { "PanelMoveHome", CK_PanelMoveHome
},
398 { "PanelNextPage", CK_PanelNextPage
},
399 { "PanelPrevPage", CK_PanelPrevPage
},
401 { "PanelSetPanelEncoding", CK_PanelSetPanelEncoding
},
403 { "PanelStartSearch", CK_PanelStartSearch
},
404 { "PanelSyncOtherPanel", CK_PanelSyncOtherPanel
},
405 { "PanelToggleSortOrderNext", CK_PanelToggleSortOrderNext
},
406 { "PanelToggleSortOrderPrev", CK_PanelToggleSortOrderPrev
},
407 { "PanelSelectSortOrder", CK_PanelSelectSortOrder
},
408 { "PanelReverseSort", CK_PanelReverseSort
},
409 { "PanelSortOrderByName", CK_PanelSortOrderByName
},
410 { "PanelSortOrderByExt", CK_PanelSortOrderByExt
},
411 { "PanelSortOrderBySize", CK_PanelSortOrderBySize
},
412 { "PanelSortOrderByMTime", CK_PanelSortOrderByMTime
},
415 { "InputBol", CK_InputBol
},
416 { "InputEol", CK_InputEol
},
417 { "InputMoveLeft", CK_InputMoveLeft
},
418 { "InputWordLeft", CK_InputWordLeft
},
419 { "InputBackwardChar", CK_InputBackwardChar
},
420 { "InputBackwardWord", CK_InputBackwardWord
},
421 { "InputMoveRight", CK_InputMoveRight
},
422 { "InputWordRight", CK_InputWordRight
},
423 { "InputForwardChar", CK_InputForwardChar
},
424 { "InputForwardWord", CK_InputForwardWord
},
425 { "InputBackwardDelete", CK_InputBackwardDelete
},
426 { "InputDeleteChar", CK_InputDeleteChar
},
427 { "InputKillWord", CK_InputKillWord
},
428 { "InputBackwardKillWord", CK_InputBackwardKillWord
},
429 { "InputSetMark", CK_InputSetMark
},
430 { "InputKillRegion", CK_InputKillRegion
},
431 { "InputYank", CK_InputYank
},
432 { "InputKillLine", CK_InputKillLine
},
433 { "InputHistoryPrev", CK_InputHistoryPrev
},
434 { "InputHistoryNext", CK_InputHistoryNext
},
435 { "InputHistoryShow", CK_InputHistoryShow
},
436 { "InputComplete", CK_InputComplete
},
437 { "InputXStore", CK_InputKillSave
},
438 { "InputXPaste", CK_InputPaste
},
439 { "InputClearLine", CK_InputClearLine
},
442 { "ExtMap1", CK_StartExtMap1
},
443 { "ExtMap2", CK_StartExtMap2
},
444 { "ShowCommandLine", CK_ShowCommandLine
},
445 { "SelectCodepage", CK_SelectCodepage
},
447 { NULL
, CK_Ignore_Key
}
450 static const size_t num_command_names
= sizeof (command_names
) /
451 sizeof (command_names
[0]) - 1;
453 /*** global variables ****************************************************************************/
455 /* viewer/actions_cmd.c */
456 const global_keymap_t default_viewer_keymap
[] = {
457 { KEY_F (1), CK_ViewHelp
, "F1" },
458 { KEY_F (2), CK_ViewToggleWrapMode
, "F2" },
459 { KEY_F (3), CK_ViewQuit
, "F3" },
460 { KEY_F (4), CK_ViewToggleHexMode
, "F4" },
461 { KEY_F (5), CK_ViewGoto
, "F5" },
462 { KEY_F (7), CK_ViewSearch
, "F7" },
463 { KEY_F (8), CK_ViewToggleMagicMode
, "F8" },
464 { KEY_F (9), CK_ViewToggleNroffMode
, "F9" },
465 { KEY_F (10), CK_ViewQuit
, "F10" },
467 { '?', CK_ViewSearch
, "?" },
468 { '/', CK_ViewSearch
, "/" },
469 { XCTRL ('r'), CK_ViewContinueSearch
, "C-r" },
470 { XCTRL ('s'), CK_ViewContinueSearch
, "C-s" },
471 { KEY_F (17), CK_ViewContinueSearch
, "S-F7" },
472 { 'n', CK_ViewContinueSearch
, "n" },
473 { ALT ('r'), CK_ViewToggleRuler
, "M-r" },
475 { XCTRL ('a'), CK_ViewMoveToBol
, "C-a" },
476 { XCTRL ('e'), CK_ViewMoveToEol
, "C-e" },
478 { 'h', CK_ViewMoveLeft
, "h" },
479 { KEY_LEFT
, CK_ViewMoveLeft
, "Left" },
481 { 'l', CK_ViewMoveRight
, "l" },
482 { KEY_RIGHT
, CK_ViewMoveRight
, "Right" },
484 { 'k', CK_ViewMoveUp
, "k" },
485 { 'y', CK_ViewMoveUp
, "y" },
486 { KEY_IC
, CK_ViewMoveUp
, "Insert" },
487 { KEY_UP
, CK_ViewMoveUp
, "Up" },
489 { 'j', CK_ViewMoveDown
, "j" },
490 { 'e', CK_ViewMoveDown
, "e" },
491 { KEY_DOWN
, CK_ViewMoveDown
, "Down" },
492 { KEY_DC
, CK_ViewMoveDown
, "Delete" },
494 { ' ', CK_ViewMovePgDn
, "Space" },
495 { 'f', CK_ViewMovePgDn
, "f" },
496 { KEY_NPAGE
, CK_ViewMovePgDn
, "PgDn" },
498 { 'b', CK_ViewMovePgUp
, "b" },
499 { KEY_PPAGE
, CK_ViewMovePgUp
, "PgUp" },
501 { 'd', CK_ViewMoveHalfPgDn
, "d" },
502 { 'u', CK_ViewMoveHalfPgUp
, "u" },
504 { 'm', CK_ViewGotoBookmark
, "m" },
505 { 'r', CK_ViewNewBookmark
, "r" },
507 { XCTRL ('f'), CK_ViewNextFile
, "C-f" },
508 { XCTRL ('b'), CK_ViewPrevFile
, "C-b" },
510 { 'q', CK_ViewQuit
, "q" },
511 { XCTRL ('g'), CK_ViewQuit
, "C-g" },
512 { ESC_CHAR
, CK_ViewQuit
, "Esc" },
514 { ALT ('e'), CK_SelectCodepage
, "M-e" },
515 { XCTRL ('o'), CK_ShowCommandLine
, "C-o" },
517 { 0, CK_Ignore_Key
, "" }
520 const global_keymap_t default_viewer_hex_keymap
[] = {
521 { KEY_F (1), CK_ViewHelp
, "F1" },
522 { KEY_F (2), CK_ViewToggleHexEditMode
, "F2" },
523 { KEY_F (3), CK_ViewQuit
, "F3" },
524 { KEY_F (4), CK_ViewToggleHexMode
, "F4" },
525 { KEY_F (5), CK_ViewGoto
, "F5" },
526 { KEY_F (6), CK_ViewHexEditSave
, "F6" },
527 { KEY_F (7), CK_ViewSearch
, "F7" },
528 { KEY_F (8), CK_ViewToggleMagicMode
, "F8" },
529 { KEY_F (9), CK_ViewToggleNroffMode
, "F9" },
530 { KEY_F (10), CK_ViewQuit
, "F10" },
532 { '?', CK_ViewSearch
, "?" },
533 { '/', CK_ViewSearch
, "/" },
534 { XCTRL ('r'), CK_ViewContinueSearch
, "C-r" },
535 { XCTRL ('s'), CK_ViewContinueSearch
, "C-s" },
536 { KEY_F (17), CK_ViewContinueSearch
, "S-F7" },
537 { 'n', CK_ViewContinueSearch
, "n" },
539 { '\t', CK_ViewToggleHexNavMode
, "Tab" },
540 { XCTRL ('a'), CK_ViewMoveToBol
, "C-a" },
541 { XCTRL ('e'), CK_ViewMoveToEol
, "C-e" },
543 { 'b', CK_ViewMoveLeft
, "b" },
544 { KEY_LEFT
, CK_ViewMoveLeft
, "Left" },
546 { 'f', CK_ViewMoveRight
, "f" },
547 { KEY_RIGHT
, CK_ViewMoveRight
, "Right" },
549 { 'k', CK_ViewMoveUp
, "k" },
550 { 'y', CK_ViewMoveUp
, "y" },
551 { KEY_UP
, CK_ViewMoveUp
, "Up" },
553 { 'j', CK_ViewMoveDown
, "j" },
554 { KEY_DOWN
, CK_ViewMoveDown
, "Down" },
555 { KEY_DC
, CK_ViewMoveDown
, "Delete" },
557 { 'q', CK_ViewQuit
, "q" },
558 { XCTRL ('g'), CK_ViewQuit
, "C-g" },
559 { ESC_CHAR
, CK_ViewQuit
, "Esc" },
561 { ALT ('e'), CK_SelectCodepage
, "M-e" },
562 { XCTRL ('o'), CK_ShowCommandLine
, "C-o" },
564 { 0, CK_Ignore_Key
, "" }
567 #ifdef USE_INTERNAL_EDIT
568 /* ../edit/editkeys.c */
569 const global_keymap_t default_editor_keymap
[] = {
570 { '\n', CK_Enter
, "Enter" },
571 { '\t', CK_Tab
, "Tab" },
573 { KEY_F (1), CK_Help
, "F1" },
574 { KEY_F (2), CK_Save
, "F2" },
575 { KEY_F (3), CK_Mark
, "F3" },
576 { KEY_F (4), CK_Replace
, "F4" },
577 { KEY_F (5), CK_Copy
, "F5" },
578 { KEY_F (6), CK_Move
, "F6" },
579 { KEY_F (7), CK_Find
, "F7" },
580 { KEY_F (8), CK_Remove
, "F8" },
581 { KEY_F (9), CK_Menu
, "F9" },
582 { KEY_F (10), CK_Quit
, "F10" },
584 { KEY_F (11), CK_User_Menu
, "S-F1" },
585 { KEY_F (12), CK_Save_As
, "S-F2" },
586 { KEY_F (13), CK_Column_Mark
, "S-F3" },
587 { KEY_F (14), CK_Replace_Again
, "S-F4" },
588 { KEY_F (15), CK_Insert_File
, "S-F5" },
589 { KEY_F (17), CK_Find_Again
, "S-F7" },
591 { KEY_F (19), CK_Pipe_Block (0), "S-F9" },
593 { ESC_CHAR
, CK_Quit
, "Esc" },
594 { KEY_BACKSPACE
, CK_BackSpace
, "BackSpace" },
595 { KEY_DC
, CK_Delete
, "Delete" },
596 { KEY_DOWN
, CK_Down
, "Down" },
597 { KEY_END
, CK_End
, "End" },
598 { KEY_HOME
, CK_Home
, "Home" },
599 { KEY_IC
, CK_Toggle_Insert
, "Insert" },
600 { KEY_LEFT
, CK_Left
, "Left" },
601 { KEY_NPAGE
, CK_Page_Down
, "PgDn" },
602 { KEY_PPAGE
, CK_Page_Up
, "PgUp" },
603 { KEY_RIGHT
, CK_Right
, "Right" },
604 { KEY_UP
, CK_Up
, "Up" },
607 { KEY_M_CTRL
| (KEY_F (2)), CK_Save_As
, "C-F2" },
608 { KEY_M_CTRL
| (KEY_F (4)), CK_Replace_Again
, "C-F4" },
609 { KEY_M_CTRL
| (KEY_F (7)), CK_Find_Again
, "C-F7" },
610 { KEY_M_CTRL
| KEY_BACKSPACE
, CK_Undo
, "C-BackSpace" },
611 { KEY_M_CTRL
| KEY_NPAGE
, CK_End_Of_Text
, "C-PgDn" },
612 { KEY_M_CTRL
| KEY_PPAGE
, CK_Beginning_Of_Text
, "C-PgUp" },
613 { KEY_M_CTRL
| KEY_HOME
, CK_Beginning_Of_Text
, "C-Home" },
614 { KEY_M_CTRL
| KEY_END
, CK_End_Of_Text
, "C-End" },
615 { KEY_M_CTRL
| KEY_UP
, CK_Scroll_Up
, "C-Up" },
616 { KEY_M_CTRL
| KEY_DOWN
, CK_Scroll_Down
, "C-Down" },
617 { KEY_M_CTRL
| KEY_LEFT
, CK_Word_Left
, "C-Left" },
618 { KEY_M_CTRL
| KEY_RIGHT
, CK_Word_Right
, "C-Right" },
619 { KEY_M_CTRL
| KEY_IC
, CK_XStore
, "C-Insert" },
620 { KEY_M_CTRL
| KEY_DC
, CK_Remove
, "C-Delete" },
622 { XCTRL ('n'), CK_New
, "C-n" },
623 { XCTRL ('k'), CK_Delete_To_Line_End
, "C-k" },
624 { XCTRL ('l'), CK_Refresh
, "C-l" },
625 { XCTRL ('o'), CK_Shell
, "C-o" },
626 { XCTRL ('s'), CK_Toggle_Syntax
, "C-s" },
627 { XCTRL ('u'), CK_Undo
, "C-u" },
628 { ALT ('e'), CK_SelectCodepage
, "M-e" },
629 { XCTRL ('q'), CK_Insert_Literal
, "C-q" },
630 { XCTRL ('r'), CK_Begin_End_Macro
, "C-r" },
631 { XCTRL ('r'), CK_Begin_Record_Macro
, "C-r" },
632 { XCTRL ('r'), CK_End_Record_Macro
, "C-r" },
633 { XCTRL ('a'), CK_Execute_Macro
, "C-a" },
636 { KEY_M_SHIFT
| KEY_NPAGE
, CK_Page_Down_Highlight
, "S-PgDn" },
637 { KEY_M_SHIFT
| KEY_PPAGE
, CK_Page_Up_Highlight
, "S-PgUp" },
638 { KEY_M_SHIFT
| KEY_LEFT
, CK_Left_Highlight
, "S-Left" },
639 { KEY_M_SHIFT
| KEY_RIGHT
, CK_Right_Highlight
, "S-Right" },
640 { KEY_M_SHIFT
| KEY_UP
, CK_Up_Highlight
, "S-Up" },
641 { KEY_M_SHIFT
| KEY_DOWN
, CK_Down_Highlight
, "S-Down" },
642 { KEY_M_SHIFT
| KEY_HOME
, CK_Home_Highlight
, "S-Home" },
643 { KEY_M_SHIFT
| KEY_END
, CK_End_Highlight
, "S-End" },
644 { KEY_M_SHIFT
| KEY_IC
, CK_XPaste
, "S-Insert" },
645 { KEY_M_SHIFT
| KEY_DC
, CK_XCut
, "S-Delete" },
646 /* useful for pasting multiline text */
647 { KEY_M_SHIFT
| '\n', CK_Return
, "S-Enter" },
650 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_NPAGE
, CK_End_Of_Text_Highlight
, "C-S-PgDn" },
651 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_PPAGE
, CK_Beginning_Of_Text_Highlight
, "C-S-PgUp" },
652 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_LEFT
, CK_Word_Left_Highlight
, "C-S-Left" },
653 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_RIGHT
, CK_Word_Right_Highlight
, "C-S-Right" },
654 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_UP
, CK_Scroll_Up_Highlight
, "C-S-Up" },
655 { KEY_M_SHIFT
| KEY_M_CTRL
| KEY_DOWN
, CK_Scroll_Down_Highlight
, "C-S-Down" },
658 { KEY_M_ALT
| KEY_NPAGE
, CK_Page_Down_Alt_Highlight
, "M-PgDn" },
659 { KEY_M_ALT
| KEY_PPAGE
, CK_Page_Up_Alt_Highlight
, "M-PgUp" },
660 { KEY_M_ALT
| KEY_LEFT
, CK_Left_Alt_Highlight
, "M-Left" },
661 { KEY_M_ALT
| KEY_RIGHT
, CK_Right_Alt_Highlight
, "M-Right" },
662 { KEY_M_ALT
| KEY_UP
, CK_Up_Alt_Highlight
, "M-Up" },
663 { KEY_M_ALT
| KEY_DOWN
, CK_Down_Alt_Highlight
, "M-Down" },
664 { KEY_M_ALT
| KEY_HOME
, CK_Home_Highlight
, "M-Home" },
665 { KEY_M_ALT
| KEY_END
, CK_End_Alt_Highlight
, "M-End" },
667 { ALT ('\n'), CK_Find_Definition
, "M-Enter" },
668 { ALT ('\t'), CK_Complete_Word
, "M-Tab" },
669 { ALT ('l'), CK_Goto
, "M-l" },
670 { ALT ('L'), CK_Goto
, "M-L" },
671 { ALT ('p'), CK_Paragraph_Format
, "M-p" },
672 { ALT ('t'), CK_Sort
, "M-t" },
673 { ALT ('u'), CK_ExtCmd
, "M-u" },
674 { ALT ('<'), CK_Beginning_Of_Text
, "M-<" },
675 { ALT ('>'), CK_End_Of_Text
, "M->" },
676 { ALT ('-'), CK_Load_Prev_File
, "M--" },
677 { ALT ('+'), CK_Load_Next_File
, "M-+" },
678 { ALT ('d'), CK_Delete_Word_Right
, "M-d" },
679 { ALT (KEY_BACKSPACE
), CK_Delete_Word_Left
, "M-BackSpace" },
680 { ALT ('n'), CK_Toggle_Line_State
, "M-n" },
681 { ALT ('_'), CK_Toggle_Tab_TWS
, "M-_" },
682 { ALT ('k'), CK_Toggle_Bookmark
, "M-k" },
683 { ALT ('i'), CK_Prev_Bookmark
, "M-i" },
684 { ALT ('j'), CK_Next_Bookmark
, "M-j" },
685 { ALT ('o'), CK_Flush_Bookmarks
, "M-o" },
687 { XCTRL ('x'), CK_Ext_Mode
, "C-x" },
689 { 0, CK_Ignore_Key
, "" }
692 /* emacs keyboard layout emulation */
693 const global_keymap_t default_editor_x_keymap
[] = {
695 { 'e', CK_Execute_Macro
, "e"},
696 { 0, CK_Ignore_Key
, "" }
698 #endif /* USE_INTERNAL_EDIT */
701 const global_keymap_t default_tree_keymap
[] = {
702 { KEY_F (1), CK_TreeHelp
, "F1"},
703 { KEY_F (2), CK_TreeRescan
, "F2" },
704 { KEY_F (3), CK_TreeForget
, "F3" },
705 { KEY_F (4), CK_TreeToggleNav
, "F4" },
706 { KEY_F (5), CK_TreeCopy
, "F5" },
707 { KEY_F (6), CK_TreeMove
, "F6" },
709 { KEY_F (7), CK_TreeMake
, "F7" },
711 { KEY_F (8), CK_TreeRemove
, "F8" },
712 { KEY_UP
, CK_TreeMoveUp
, "Up" },
713 { XCTRL ('p'), CK_TreeMoveUp
, "C-p" },
714 { KEY_DOWN
, CK_TreeMoveDown
, "Down" },
715 { XCTRL ('n'), CK_TreeMoveDown
, "C-n" },
716 { KEY_LEFT
, CK_TreeMoveLeft
, "Left" },
717 { KEY_RIGHT
, CK_TreeMoveRight
, "Right" },
718 { KEY_HOME
, CK_TreeMoveHome
, "Home" },
719 { ALT ('<'), CK_TreeMoveHome
, "M-<" },
720 { KEY_END
, CK_TreeMoveEnd
, "End" },
721 { ALT ('>'), CK_TreeMoveEnd
, "M->" },
722 { KEY_PPAGE
, CK_TreeMovePgUp
, "PgUp" },
723 { ALT ('v'), CK_TreeMovePgUp
, "M-v" },
724 { KEY_NPAGE
, CK_TreeMovePgDn
, "PnDn" },
725 { XCTRL ('v'), CK_TreeMovePgDn
, "C-v" },
726 { '\n', CK_TreeOpen
, "Enter" },
727 { KEY_ENTER
, CK_TreeOpen
, "Enter" },
728 { XCTRL ('r'), CK_TreeRescan
, "C-r" },
729 { XCTRL ('s'), CK_TreeStartSearch
, "C-s" },
730 { ALT ('s'), CK_TreeStartSearch
, "M-s" },
731 { KEY_DC
, CK_TreeRemove
, "Delete" },
732 { 0, CK_Ignore_Key
, ""}
736 const global_keymap_t default_help_keymap
[] = {
737 { KEY_F (1), CK_HelpHelp
, "F1" },
738 { KEY_F (2), CK_HelpIndex
, "F2" },
739 { KEY_F (3), CK_HelpBack
, "F3" },
740 { KEY_F (10), CK_HelpQuit
, "F10" },
741 { KEY_LEFT
, CK_HelpBack
, "Left" },
742 { 'l', CK_HelpBack
, "l" },
743 { KEY_DOWN
, CK_HelpMoveDown
, "Down" },
744 { KEY_UP
, CK_HelpMoveUp
, "Up" },
745 { KEY_RIGHT
, CK_HelpSelectLink
, "Right" },
746 { KEY_ENTER
, CK_HelpSelectLink
, "Enter" },
747 { '\n', CK_HelpSelectLink
, "Enter" },
748 { '\t', CK_HelpNextLink
, "Tab" },
749 { ALT ('\t'), CK_HelpPrevLink
, "M-Tab" },
750 { 'n', CK_HelpNextNode
, "n" },
751 { 'p', CK_HelpPrevNode
, "p" },
752 { ESC_CHAR
, CK_HelpQuit
, "Esc" },
753 { XCTRL ('g'), CK_HelpQuit
, "C-g" },
754 { 0, CK_Ignore_Key
, "" }
758 const global_keymap_t default_panel_keymap
[] = {
759 { ALT ('o'), CK_PanelChdirOtherPanel
, "M-o" },
760 { ALT ('l'), CK_PanelChdirToReadlink
, "M-l" },
761 { KEY_F (15), CK_PanelCmdCopyLocal
, "S-F5" },
762 { KEY_F (18), CK_PanelCmdDeleteLocal
, "S-F8" },
763 { KEY_ENTER
, CK_PanelCmdDoEnter
, "Enter" },
764 { '\n', CK_PanelCmdDoEnter
, "Enter" },
765 { KEY_F (14), CK_PanelCmdEditNew
, "S-F4" },
766 { KEY_F (16), CK_PanelCmdRenameLocal
, "S-F6" },
767 { ALT ('*'), CK_PanelCmdReverseSelection
, "M-*" },
768 { KEY_KP_ADD
, CK_PanelCmdSelect
, "M-+" },
769 { KEY_KP_SUBTRACT
, CK_PanelCmdUnselect
, "M--" },
770 { KEY_F (13), CK_PanelCmdViewSimple
, "S-F3" },
771 { KEY_M_CTRL
| KEY_NPAGE
, CK_PanelCtrlNextPage
, "C-PgDn" },
772 { KEY_M_CTRL
| KEY_PPAGE
, CK_PanelCtrlPrevPage
, "C-PgUp" },
773 { ALT ('H'), CK_PanelDirectoryHistoryList
, "M-H" },
774 { ALT ('u'), CK_PanelDirectoryHistoryNext
, "M-u" },
775 { ALT ('y'), CK_PanelDirectoryHistoryPrev
, "M-y" },
776 { ALT ('j'), CK_PanelGotoBottomFile
, "M-j" },
777 { ALT ('r'), CK_PanelGotoMiddleFile
, "M-r" },
778 { ALT ('g'), CK_PanelGotoTopFile
, "M-g" },
779 { KEY_IC
, CK_PanelMarkFile
, "Insert" },
780 { KEY_UP
, CK_PanelMoveUp
, "Up" },
781 { KEY_DOWN
, CK_PanelMoveDown
, "Down" },
782 { KEY_LEFT
, CK_PanelMoveLeft
, "Left" },
783 { KEY_RIGHT
, CK_PanelMoveRight
, "Right" },
784 { KEY_END
, CK_PanelMoveEnd
, "End" },
785 { KEY_HOME
, CK_PanelMoveHome
, "Home" },
786 { KEY_A1
, CK_PanelMoveHome
, "Home" },
787 { KEY_NPAGE
, CK_PanelNextPage
, "PgDn" },
788 { KEY_PPAGE
, CK_PanelPrevPage
, "PgUp" },
789 { ALT ('e'), CK_PanelSetPanelEncoding
, "M-e" },
790 { XCTRL ('s'), CK_PanelStartSearch
, "C-s" },
791 { ALT ('s'), CK_PanelStartSearch
, "M-s" },
792 { ALT ('i'), CK_PanelSyncOtherPanel
, "M-i" },
793 { 0, CK_Ignore_Key
, "" }
797 const global_keymap_t default_main_map
[] = {
798 { KEY_F (1), CK_HelpCmd
, "F1" },
799 { KEY_F (2), CK_UserMenuCmd
, "F2" },
800 { KEY_F (3), CK_ViewCmd
, "F3" },
801 { KEY_F (4), CK_EditCmd
, "F4" },
802 { KEY_F (5), CK_CopyCmd
, "F5" },
803 { KEY_F (6), CK_RenameCmd
, "F6" },
804 { KEY_F (7), CK_MkdirCmd
, "F7" },
805 { KEY_F (8), CK_DeleteCmd
, "F8" },
806 { KEY_F (9), CK_MenuCmd
, "F9" },
807 { KEY_F (10), CK_QuitCmd
, "F10" },
808 { KEY_F (13), CK_ViewFileCmd
, "S-F3" },
809 { KEY_F (19), CK_MenuLastSelectedCmd
, "S-F9" },
810 { KEY_F (20), CK_QuietQuitCmd
, "S-10" },
811 { ALT ('h'), CK_HistoryCmd
, "M-h" },
812 { XCTRL ('@'), CK_SingleDirsizeCmd
, "C-Space" },
813 /* Copy useful information to the command line */
814 { ALT ('a'), CK_CopyCurrentPathname
, "M-a" },
815 { ALT ('A'), CK_CopyOtherPathname
, "M-A" },
816 { ALT ('c'), CK_QuickCdCmd
, "M-c" },
817 /* To access the directory hotlist */
818 { XCTRL ('\\'), CK_QuickChdirCmd
, "C-\\" },
820 { XCTRL ('z'), CK_SuspendCmd
, "C-z" },
821 /* The filtered view command */
822 { ALT ('!'), CK_FilteredViewCmd
, "M-!" },
824 { ALT ('?'), CK_FindCmd
, "M-?" },
826 { XCTRL ('r'), CK_RereadCmd
, "C-r" },
827 /* Toggle listing between long, user defined and full formats */
828 { ALT ('t'), CK_ToggleListingCmd
, "M-t" },
830 { XCTRL ('u'), CK_SwapCmd
, "C-u" },
832 { XCTRL ('o'), CK_ShowCommandLine
, "C-o" },
833 { ALT ('.'), CK_ToggleShowHidden
, "M-." },
834 { ALT (','), CK_TogglePanelsSplit
, "M-," },
835 { XCTRL ('x'), CK_StartExtMap1
, "C-x" },
836 /* Select/unselect group */
837 { KEY_KP_ADD
, CK_SelectCmd
, "+" },
838 { KEY_KP_SUBTRACT
, CK_UnselectCmd
, "-" },
839 { ALT ('*'), CK_ReverseSelectionCmd
, "*" },
840 { 0, CK_Ignore_Key
, "" }
843 const global_keymap_t default_main_x_map
[] = {
844 { 'd', CK_CompareDirsCmd
, "d" },
846 { 'a', CK_ReselectVfs
, "a"},
847 #endif /* ENABLE_VFS */
848 { 'p', CK_CopyCurrentPathname
, "p" },
849 { XCTRL ('p'), CK_CopyOtherPathname
, "C-p" },
850 { 't', CK_CopyCurrentTagged
, "t" },
851 { XCTRL ('t'), CK_CopyOtherTagged
, "C-t" },
852 { 'c', CK_ChmodCmd
, "c" },
853 { 'o', CK_ChownCmd
, "o" },
854 { 'r', CK_CopyCurrentReadlink
, "r" },
855 { XCTRL ('r'), CK_CopyOtherReadlink
, "C-r" },
856 { 'l', CK_LinkCmd
, "l" },
857 { 's', CK_SymlinkCmd
, "s" },
858 { XCTRL ('s'), CK_EditSymlinkCmd
, "C-s" },
859 { 'i', CK_InfoCmd
, "i" },
860 { 'q', CK_QuickViewCmd
, "q" },
861 { 'h', CK_AddHotlist
, "h" },
862 { '!', CK_ExternalPanelize
, "!" },
863 #ifdef WITH_BACKGROUND
864 { 'j', CK_JobsCmd
, "j" },
865 #endif /* WITH_BACKGROUND */
866 { 0, CK_Ignore_Key
, "" }
869 const global_keymap_t default_input_keymap
[] = {
871 { XCTRL ('a'), CK_InputBol
, "C-a" },
872 { KEY_HOME
, CK_InputBol
, "Home" },
873 { KEY_A1
, CK_InputBol
, "Home" },
874 { ALT ('<'), CK_InputBol
, "M-<" },
875 { XCTRL ('e'), CK_InputEol
, "C-e" },
876 { KEY_END
, CK_InputEol
, "End" },
877 { KEY_C1
, CK_InputEol
, "End" },
878 { ALT ('>'), CK_InputEol
, "M->" },
879 { KEY_LEFT
, CK_InputMoveLeft
, "Left" },
880 { KEY_M_CTRL
| KEY_LEFT
, CK_InputWordLeft
, "C-Left" },
881 { KEY_RIGHT
, CK_InputMoveRight
, "Right" },
882 { KEY_M_CTRL
| KEY_RIGHT
, CK_InputWordRight
, "C-Right" },
884 { XCTRL ('b'), CK_InputBackwardChar
, "C-b" },
885 { ALT ('b'), CK_InputBackwardWord
, "M-b" },
886 { XCTRL ('f'), CK_InputForwardChar
, "C-f" },
887 { ALT ('f'), CK_InputForwardWord
, "M-f" },
890 { KEY_BACKSPACE
, CK_InputBackwardDelete
, "BackSpace" },
891 { KEY_DC
, CK_InputDeleteChar
, "Delete" },
892 { ALT ('d'), CK_InputKillWord
, "M-d" },
893 { ALT (KEY_BACKSPACE
), CK_InputBackwardKillWord
, "M-BackSpace" },
895 /* Region manipulation */
896 { XCTRL ('w'), CK_InputKillRegion
, "C-w" },
897 { ALT ('w'), CK_InputKillSave
, "M-w" },
898 { XCTRL ('y'), CK_InputYank
, "C-y" },
899 { XCTRL ('k'), CK_InputKillLine
, "C-k" },
902 { ALT ('p'), CK_InputHistoryPrev
, "M-p" },
903 { ALT ('n'), CK_InputHistoryNext
, "M-n" },
904 { ALT ('h'), CK_InputHistoryShow
, "M-h" },
907 { ALT ('\t'), CK_InputComplete
, "M-tab" },
909 { 0, CK_Ignore_Key
, "" }
913 name_keymap_comparator (const void *p1
, const void *p2
)
915 const name_keymap_t
*m1
= (const name_keymap_t
*) p1
;
916 const name_keymap_t
*m2
= (const name_keymap_t
*) p2
;
918 return str_casecmp (m1
->name
, m2
->name
);
922 sort_command_names (void)
924 static gboolean has_been_sorted
= FALSE
;
926 if (!has_been_sorted
) {
927 qsort (command_names
, num_command_names
,
928 sizeof (command_names
[0]), &name_keymap_comparator
);
929 has_been_sorted
= TRUE
;
934 keymap_add (GArray
*keymap
, long key
, unsigned long cmd
, const char *caption
)
936 if (key
!= 0 && cmd
!= CK_Ignore_Key
) {
937 global_keymap_t new_bind
;
940 new_bind
.command
= cmd
;
941 g_snprintf (new_bind
.caption
, sizeof (new_bind
.caption
), "%s", caption
);
942 g_array_append_val (keymap
, new_bind
);
947 keybind_cmd_bind (GArray
*keymap
, const char *keybind
, unsigned long action
)
949 char *caption
= NULL
;
952 key
= lookup_key (keybind
, &caption
);
953 keymap_add (keymap
, key
, action
, caption
);
958 lookup_action (const char *name
)
960 const name_keymap_t key
= { name
, 0 };
963 sort_command_names ();
965 res
= bsearch (&key
, command_names
, num_command_names
,
966 sizeof (command_names
[0]), name_keymap_comparator
);
968 return (res
!= NULL
) ? res
->val
: CK_Ignore_Key
;
972 lookup_keymap_shortcut (const global_keymap_t
*keymap
, unsigned long action
)
976 for (i
= 0; keymap
[i
].key
!= 0; i
++)
977 if (keymap
[i
].command
== action
)
978 return (keymap
[i
].caption
[0] != '\0') ? keymap
[i
].caption
: NULL
;
984 lookup_keymap_command (const global_keymap_t
*keymap
, long key
)
988 for (i
= 0; keymap
[i
].key
!= 0; i
++)
989 if (keymap
[i
].key
== key
)
990 return keymap
[i
].command
;
992 return CK_Ignore_Key
;