How to Install GNOME Text Editor to Replace Gedit in Ubuntu 22.04

Ubuntu has proposed to replace the default Gedit with GNOME Text Editor in the next Ubuntu 22.10. Here’s how to do the trick for those who want to try it out in Ubuntu 22.04 LTS.

GNOME Text Editor is one of the new default apps in GNOME 42. It’s a GTK4 app uses Libadwaita library that follows GNOME design more closely than the previous Gedit text editor.

The editor fully supports the GNOME 42 dark theme preference, has improved auto-save, including autosaving “unsaved” “draft” files. And, it includes many popular features and options without plugins. So, Ubuntu proposed to use it to replace Gedit in the next 22.10 release.

Gnome Text Editor Ligh/Dark Mode

1. Install GNOME Text Editor in Ubuntu 22.04

Fedora 36 has already take use of the new text editor. For Ubuntu 22.04, it’s available in the universe repository.

To install it, press Ctrl+Alt+T on keyboard to open terminal and run the command:

sudo apt install gnome-text-editor

Type user password for sudo authentication, though there’s no asterisk feedback. And for new installed system, you may run sudo apt update first to generate package cache.

After that, press Win (or Super) key on keyboard, then search for and launch the text editor. You’ll see two apps display as “Text Editor” but with different icons.

2. Set GNOME Text Editor as Default

Set default for plain text:

If you like the new text editor, you may set it as default by simply right-clicking on a document file. Then select “Properties“.

In the pop-up dialog, navigate to “Open With” tab, select the GNOME Text Editor, and finally click on “Set as Default” button.

There are 2 "Text Editor", keep an eye on the app icon to tell difference.

Set default for other documents:

The update-alternatives command seems not working for this one. The system default is ‘/usr/bin/gnome-text-editor’ which links to gedit. The new Gnome Text Editor has same executable file that seems breaking it.

For other file formats, besides setting it in file “Properties” dialog one by one, user may run the command below in terminal (Ctrl+Alt+T) to edit the config file:

gnome-text-editor ~/.config/mimeapps.list

When file opens, add any line below as you prefer under both “[Default Applications]” and “[Added Associations]” (need “;” in the end) sections.

application/x-perl=org.gnome.TextEditor.desktop
text/x-chdr=org.gnome.TextEditor.desktop
text/x-csrc=org.gnome.TextEditor.desktop
text/x-dtd=org.gnome.TextEditor.desktop
text/x-java=org.gnome.TextEditor.desktop
text/mathml=org.gnome.TextEditor.desktop
text/x-python=org.gnome.TextEditor.desktop
text/x-sql=org.gnome.TextEditor.desktop
text/xml=org.gnome.TextEditor.desktop

3. Add alias for command line use:

Since the command gnome-text-editor is a bit clunky to type in the terminal. User may add an alias to it by running command:

alias gtext="gnome-text-editor"

Replace gtext with whatever as you want. Then, you can type it in terminal (gtext in my case) instead of gnome-text-editor to use the text editor from command line.

That’s all. Enjoy!

Exit mobile version