Ubuntu – Change Xubuntu’s default text editor globally

13.04default-programsxfcexubuntu

There's a lot of tutorials on how to change the default text editor in Unity and Gnome. There's none for Xubuntu/XFCE.

How do I change all mousepad's associations to sublime text?

I know I could install Unity Tweak Tool, but that loads a lot of dependencies, including compiz. I don't want that.

I know I can right click a file and do "Open with". There's a lot of file types I am willing to change (ruby, php, html, css, js, coffee,…), so that's not the way either.

update-alternatives is not the way either:

There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/vim.gtk    50        auto mode
  1            /bin/ed            -100       manual mode
  2            /bin/nano           40        manual mode
  3            /usr/bin/vim.gtk    50        manual mode
  4            /usr/bin/vim.tiny   10        manual mode

Press enter to keep the current choice[*], or type selection number: 

Best Answer

If you do not want to install additional applications you will have to manually edit ~/.local/share/applications/mimeapps.list

Under the [Added Associations] section add:

application/x-perl=sublime.desktop
text/plain=sublime.desktop
text/x-chdr=sublime.desktop
text/x-csrc=sublime.desktop
text/x-dtd=sublime.desktop
text/x-java=sublime.desktop
text/mathml=sublime.desktop
text/x-python=sublime.desktop
text/x-sql=sublime.desktop
text/x-tex=sublime.desktop
Related Question