How to set a default text editor in Gnome?

Gnome appears to have removed the default application (per-filetype) selection from Nautilus’ ‘open with’ context menu and in settings > ‘default applications’ there’s no category for text editor. I currently prefer using a third-party editor and gedit is still opened seemingly at random, even for plaintext text files without a file extension on my system.

Sure, I could open everything from terminal, but I’m not ready to drop GUI yet. If I uninstalled gedit I may break my OS installation:

 gedit                      x86_64     2:3.36.2-1.fc32      @updates       14 M
Removing unused dependencies:
 amtk                       x86_64     5.0.2-2.fc32         @anaconda     135 k
 gtksourceview4             x86_64     4.6.1-1.fc32         @updates      4.6 M
 libpeas-loader-python3     x86_64     1.26.0-1.fc32        @anaconda      32 k
 tepl                       x86_64     4.4.0-1.fc32         @anaconda     399 k

Gnome 3.36.5

xdg-mime default org.gnome.gedit.desktop $(xdg-mime query filetype /etc/profile)
1 Like

The command is for gedit only?

You can use autocomplete to choose another application.
It’s also possible to specify multiple MIME types.

xdg-mime default chromium-freeworld.desktop \
application/pdf \
text/calendar \
text/html \
x-scheme-handler/http \
x-scheme-handler/https \
x-scheme-handler/mailto \