Set default text editor in Preferred Applications in MATE

Abstract: Set vim as the default text editor in MATE by configuring Preferred Applications with a terminal wrapper to ensure proper execution.

Created: 2026-10-15 by

To set a custom text editor like vim as the default in MATE, open the Main Menu, navigate to Preferences > Preferred Applications, select the Utilities tab, and change the Text Editor dropdown to "Other." Enter the full path to your executable, such as /usr/bin/vim, or use x-terminal-emulator -e vim if you need it to launch within a terminal window for proper functionality.

Understanding Default Application Handlers in MATE

The MATE desktop environment relies on a system of MIME types and associated handlers to determine which application opens specific file formats. When you double-click a text file, the desktop environment checks its internal database to see which program is registered as the handler for that specific type. In many Linux distributions, the default text editor is set to a graphical application like mousepad or gedit. However, developers often prefer command-line tools like vim or nano for their efficiency and customization capabilities. Changing the default editor through the GUI does not always update the underlying system configuration correctly, especially for terminal-based applications. This is because GUI editors run directly in the X11 or Wayland session, while terminal editors require a shell environment. If you simply select vim from the list without specifying how it should be launched, the system may fail to open the file or throw an error because it attempts to run the binary in a context that doesn't support standard input/output streams properly. Therefore, understanding the distinction between GUI and terminal execution is crucial for this configuration. For more advanced configurations involving Vim, you might also want to check out Vim on Arch: /etc/vimrc can remap keys but not turn off syntax highlighting to ensure your editing experience is optimized after setting it as the default.

Navigating the Preferred Applications Interface

The primary interface for managing these defaults in MATE is the "Preferred Applications" tool. You can access this by clicking the MATE menu button (usually located at the bottom left or top left depending on your panel setup), typing "Preferred Applications" into the search bar, and launching the result. Alternatively, you can run the command mate-preferred-applications in your terminal to open the dialog directly. Once the window opens, you will see several tabs corresponding to different categories of applications: Web Browser, Mail Reader, Calendar, and Utilities. The Text Editor setting is located under the Utilities tab. By default, this dropdown likely shows a specific application name. To change it, you must click the dropdown menu. If your desired editor is listed there, you can select it directly. However, if you are using a less common editor or one that requires specific launch flags, you will need to select the "Other..." option at the bottom of the list.

Configuring Vim as the Default Editor

Selecting "Other..." opens a dialog where you can manually specify the command to execute. This is the most critical step for ensuring that vim works correctly when invoked by the file manager. There are two main approaches here: launching vim directly or wrapping it in a terminal emulator. If you choose to launch vim directly by entering its absolute path (e.g., /usr/bin/vim), the behavior depends on your system's configuration. On some systems, this might work if vim is aliased to a GUI version or if the desktop environment automatically spawns a terminal. However, this often results in the terminal closing immediately after the file opens, or the editor appearing in the background without a visible window, making it difficult to interact with. A more robust solution is to force the editor to run inside a terminal. This ensures that vim has access to the necessary stdin/stdout channels and remains visible. To do this, you can use the generic terminal emulator command available on most Linux systems. Enter the following command in the "Command" field:
x-terminal-emulator -e vim %F
In this command, x-terminal-emulator is a symbolic link that points to your preferred terminal application (such as gnome-terminal, xfce4-terminal, or mate-terminal). The -e flag tells the terminal to execute the subsequent command upon opening. vim is the editor itself. The %F placeholder is important; it represents the full path to the file being opened. Without this placeholder, the editor would open without any file loaded, forcing you to manually open the file from within vim, which defeats the purpose of setting a default handler. If you prefer to use a specific terminal emulator rather than the generic link, you can replace x-terminal-emulator with the actual command, such as mate-terminal or gnome-terminal. For example:
mate-terminal -e vim %F
This approach guarantees compatibility across different MATE setups. After entering the command, click "OK" to save the changes. Your new default text editor is now configured.

Verifying and Troubleshooting the Configuration

After saving the settings, it is essential to verify that the change took effect. Open your file manager (Nemo in MATE) and locate a plain text file, such as a .txt or .md file. Double-click the file. A terminal window should open, and vim should launch with the content of that file ready for editing. If the file opens in the wrong editor, the system might be caching old preferences or using a different MIME type association. You can clear the cache by logging out and logging back in, or by running gtk-update-icon-cache if necessary. In rare cases, the MIME type associations might be stored in user-specific configuration files rather than the global preferred applications database. You can inspect these files by checking ~/.config/mimeapps.list. Look for lines starting with text/plain= to see what is currently assigned. If the entry there differs from your preferred application setting, you may need to edit this file manually or reset the associations using the xdg-mime command. For those who have just installed Vim and are facing issues with key mappings or syntax highlighting after setting it as the default, refer to Mastering Vim: A Comprehensive Guide for deeper insights into configuring your environment.

Handling Multiple Editors

You are not limited to setting only one default editor. You can configure different editors for different MIME types. For instance, you might want vim for source code files (text/x-script) and a lightweight GUI editor for simple notes. This granular control allows you to tailor your workflow precisely to your needs. The Preferred Applications interface provides a broad stroke for general text files, but for specialized workflows, manual MIME type editing offers greater flexibility.

Frequently Asked Questions

Why does my terminal close immediately after opening a file?

This usually happens because the command lacks the file path placeholder. Ensure you include %F at the end of your command string so the terminal knows which file to pass to vim. Without it, the editor launches empty and may exit if configured to quit on no arguments.

Can I use nano instead of vim for the default editor?

Yes, you can substitute vim with nano in the command string. Use x-terminal-emulator -e nano %F to set Nano as your default. The process is identical regardless of the specific terminal-based editor you choose.

How do I revert to the original default text editor?

Return to Preferred Applications > Utilities > Text Editor and select the original application from the dropdown list, such as Mousepad or Gedit. If "Other..." was selected previously, changing it back to a standard application will override the custom command.

Does this change affect all users on the system?

No, the Preferred Applications settings are typically stored in the user's home directory configuration files. Only the account you are currently logged into will see this change. Other users will retain their own default editor settings unless you modify system-wide MIME type configurations.

What if x-terminal-emulator points to the wrong terminal?

You can check which terminal x-terminal-emulator links to by running readlink -f $(which x-terminal-emulator) in your current terminal. If it is incorrect, you can update the alternatives using your distribution's package manager or replace x-terminal-emulator with the explicit name of your preferred terminal in the Preferred Applications command.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More