Setting Up Midnight Commander Double-Click to Open Files
Midnight Commander
(abbreviated as mc
) is a powerful dual-pane file manager. It runs in terminal environments and provides rich file operation functionality. However, by default, double-clicking (or pressing Enter) on a file in mc
may not perform the “open” operation we expect, especially for text files. This article will explain how to configure mc
to open files with your preferred editor when double-clicking.
Step 1: Copy Configuration File
First, we need to copy the system default mc
extension configuration file (mc.ext.ini
) to the user’s personal configuration directory. This ensures our modifications only affect the current user and won’t be overwritten during system updates.
Open terminal and execute the following commands:
mkdir -p ~/.config/mc
cp /etc/mc/mc.ext.ini ~/.config/mc/mc.ext.ini
Step 2: Modify Configuration File
Next, we need to edit the configuration file we just copied: ~/.config/mc/mc.ext.ini
. You can use any text editor you prefer, such as vim
or nano
.
vim ~/.config/mc/mc.ext.ini
In this file, you need to find the [Default]
configuration section. This section defines default operations for file types that don’t match specific rules. Find the Open=
line and modify it to:
# ... file header content ...
[Default]
# ... other default settings ...
Open=%var{EDITOR:vi} %f
# ... rest of file content ...