Setting Up Midnight Commander Double-Click to Open Files
Midnight Commander (mc) is a terminal dual-pane file manager. By default, double-clicking or pressing Enter on a file may not open it the way you expect, especially for text files. Here we change it to open files with your preferred editor.
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.ini2. 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.iniIn 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 ...