Setting Default Selected Menu Item in Midnight Commander
Midnight Commander (MC) is a popular terminal-based file manager for Unix-like systems. It provides a user-friendly interface for managing files and directories, with a dual-pane layout and various features for navigation, search, and file operations. One of the useful features of MC is the ability to customize the user menu, which allows users to define their own commands and actions. In this article, we will focus on setting the default selected menu item in MC, specifically for users who want to open files with a specific application, such as Kate in KDE Plasma.
Understanding the User Menu
The user menu in MC is a configurable menu that appears when the user presses the F2 key. It contains various commands and actions that can be customized by the user. By default, it includes options such as View, Edit, and Copy, but users can add their own commands and actions to suit their needs.
Setting the Default Selected Menu Item
To set the default selected menu item in MC, you need to modify the user menu configuration file. This file is located in your home directory, under the .config/mc/ directory, and is named menu. This file contains the definitions of the menu items, including their labels, commands, and hotkeys. To set a default selected menu item, you need to add a line with the default keyword followed by the label of the menu item. For example, to set the default selected menu item to the "Edit with Kate" command, you can add the following line to the menu file:
default = Edit with KateCreating a Custom Menu Item for Opening Files with Kate
To create a custom menu item for opening files with Kate in MC, you need to add a new entry to the menu file. The entry should contain the label, command, and hotkey for the new menu item. For example, to create a menu item for opening files with Kate, you can add the following entry to the menu file:
Edit with Kate = edit -c 'kate %f'In this example, the label of the menu item is "Edit with Kate", and the command is edit -c 'kate %f'. The %f placeholder will be replaced by the name of the selected file. The hotkey for this menu item is not specified, so it will be assigned a default hotkey by MC.
- Midnight Commander (MC) is a terminal-based file manager for Unix-like systems.
- MC allows users to customize the user menu with their own commands and actions.
- To set the default selected menu item in MC, you need to modify the user menu configuration file.
- To create a custom menu item for opening files with Kate in MC, you can add a new entry to the menu file with the label, command, and hotkey for the new menu item.