How to Change the Default Text Editor in Ubuntu GUI

When working on the Ubuntu desktop, double-clicking a plain text document (.txt), markdown file (.md), configuration file, or script opens it in the operating system’s default editor. In modern Ubuntu releases, this is typically GNOME Text Editor or Gedit. However, many users prefer more feature-rich code editors such as Visual Studio Code, Sublime Text, or Notepadqq for daily viewing and editing.

While Linux provides robust terminal commands for configuring alternatives, Ubuntu’s graphical user interface (GUI) allows you to reassign default application associations across all plain text files in just a few clicks without opening the terminal. Here is how to configure your preferred editor as the system default.

Change the Default Editor via File Properties in the Files App

The most direct way to change the default editor for all text files is through the desktop file manager (Nautilus):

  1. Open the Files application from your Ubuntu dock or application launcher.
  2. Navigate to any directory containing a plain text file (such as a .txt file).
  3. Right-click on the text document and select Properties from the contextual menu.
  4. In the Properties dialogue window, click on the Open With tab located at the top.
  5. Browse the list of installed applications and select your preferred text editor (e.g., Visual Studio Code, Sublime Text, or Gedit).
  6. Click the Set as default button in the bottom-right corner of the window.
  7. Close the Properties dialogue.

From this point onward, double-clicking any file sharing that same file extension will automatically launch your chosen editor.

Associate Multiple File Formats with Your Preferred Editor

Different document types use distinct MIME associations in Ubuntu. For example, a plain text file (.txt), a markdown file (.md), and a bash script (.sh) are treated as distinct formats. If you want your chosen editor to handle all of them, repeat the steps above once for each file extension:

  • Markdown files: Right-click a .md file, open Properties, and assign your editor as default under Open With.
  • Config and log files: Right-click a .conf or .log file and assign the same association.
  • Scripts: Right-click a script or programming file to associate it similarly.

Change Default Applications via Ubuntu System Settings

Ubuntu also offers a centralised Default Applications section inside the system settings for major application categories:

  1. Click on the system status menu in the top-right corner of your desktop and select Settings.
  2. Scroll down the left-hand navigation menu and choose Apps or Default Applications.
  3. Review the primary default categories, including Web, Mail, Calendar, Music, and Video.

Because Ubuntu handles text files at the granular file-type level rather than as a single umbrella category in modern GNOME releases, setting the association via the file Properties window remains the most dependable and comprehensive graphical technique.

Testing Your New Default Association

To verify that the change took effect smoothly, navigate to your desktop or Documents folder, create a new text file, and double-click it. It should open immediately inside your selected application, streamlining your productivity on Ubuntu.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.