Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've installed Sublime Text 3 from the .deb found here: http://www.sublimetext.com/3

Now, how to set it as the default text editor in place of gedit in Mint 16?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Open /usr/share/applications/defaults.list in Sublime:

sudo subl /usr/share/applications/defaults.list

Search for all instances of gedit and replace them with sublime_text. Save the file, quit Sublime, log out and back in, and you should be all set.

EDIT

While the above instructions should work with any .deb-based system (I use Ubuntu), apparently there is an issue with Mint where changes to /usr/share/applications/defaults.list are lost upon reboot. To work around this, do the following:

  1. Create a new file (if it doesn't already exist) called ~/.local/share/applications/defaults.list in Sublime. The first line should be [Default Applications].
  2. Open /usr/share/applications/defaults.list in Sublime. Hit CtrlF to open the Find dialog and type gedit into the search box.
  3. Hit AltEnter or click the Find All button to select all the instances of gedit in the file.
  4. Hit CtrlL to expand the selections to the entire line, then hit CtrlC to copy the lines.
  5. In ~/.local/share/applications/defaults.list, hit CtrlV to paste the lines containing gedit.
  6. Hit CtrlH to open the Replace dialog. Search for gedit and replace with sublime_text. Hit CtrlAltEnter to Replace All (or click the Replace All button) and you're all set.
  7. Save ~/.local/share/applications/defaults.list, log out and back in, and Sublime Text should now be your default text editor.
share|improve this answer
    
It works at first, but after rebooting, defaults.list gets reverted, gedit back in place of sublime_text. What can I do to prevent this? –  xichael Jan 19 at 23:58
    
Apparently this is an issue with Mint which can be circumvented by using .local/share/applications/defaults.list instead. So, I've copied/pasted/edited the gedit lines to this file, and they're now successfully overriding their counterparts in /usr/share/applications/defaults.list, even after a reboot. –  xichael Jan 20 at 1:13
    
@xichael - thanks for the info. I've updated my answer to describe exactly how to set things up to work around this issue. I usually use Ubuntu, where my original solution works fine, and since Mint is quite similar I figured it would work! –  MattDMo Jan 20 at 16:31
    
You're missing a small step: the first line on ~/.local/share/applications/defaults.list must be "[Default Applications]" for this to work –  Alexandre L Telles Sep 17 at 13:55
    
@Alexandre thanks for that, I'll update the answer. As an Ubuntu user, I've only worked with existing files, so I kinda missed that detail :) –  MattDMo Sep 17 at 15:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.