How to Change the Default Text Editor on Ubuntu With Nautilus

Further experimentation with editors for Ruby on Rails led to the question "how do I change the default editor on Ubuntu?" All of my files were opening in gedit and to override it I had to right-click on my .rb and .rhtml files and then choose my desired editor.

I finally figured out how to quickly change Ubuntu's default text editor with Nautilus:

  1. Right click on a text file
  2. Choose "Properties"
  3. Click on the "Open With" tab
  4. Choose your new default text editor

Changing the default Ubuntu text editor

I'm currently experimenting with Cream, a modified version of gvim, shown below:

Cream on Ubuntu


Comments

Not good enough

The solution you propose is just a partial workaround; the user has to repeat this procedure for every single file type which is edited as plain text, which is rather tedious if you ask me.

A better alternative is to set the default handler for the text/plain MIME type in GNOME. Unfortunately, there is no GUI tool to do it, but it doesn't take much. Just edit your ~/.local/share/applications/defaults.list (create it if you don't have one) and add the following text:

[Default Applications]
text/plain=gvim.desktop

That is, if you plan on using gvim, of course. Replace gvim with the appropriate filename otherwise (e.g., scite.desktop).

Webmaster Tips's picture

It works

Thanks for the tip. I just tried it on my computer and found a lot of interesting information in the defaults.list file. When you make the modifications that I wrote about in the post is it storing the information in the defaults.list file?

Thank you

I have been looking for this for weeks. Thank you very much!

Another option

That's works, but you can also try:

- sudo update-alternatives --config editor
- sudo update-alternatives --config gnome-text-editor

The default handler for text/* (plain, html, xhtml, xml, etc) is
/usr/bin/editor for console applications and /usr/bin/gnome-text-editor
for the gnome desktop. To change it you should run one (or both) of the
above commands. update-alternatives(8) [man 8 update-alternatives] has
a deep explanation of how this works.

Regards.
Pablo.

Syndicate content