I started using Sublime Text 2 a week or so ago and I loved it so much I've spent $60 on it and now want to use it for everything.
Gedit currently has ownership of most of the text file associations. I'd essentially like to replace any association to gedit
with sublime-text-2
.
Any tips available on bulk association changing? Desktop-neutral methods are preferred.
Running on 13.04+, update the file: /etc/gnome/defaults.list.
Credit to trent for the update to 13.04+
Pre-13.04:
System wide associations:
Just your user's associations:
Credit to Oli for the naming convention of the .desktop file before I started using SublimeText2.
Update for 16.04 Users:
Ubuntu tweak has been discontinued. Much of it's functionalities are now being provided by Unity Tweak Tool or Gnome Tweak Tool. But those still lacks Ubuntu Tweak's awesome feature of easy file-type association changing.
To install Ubuntu Tweak on these later version follow the procedure described on this answer about installing it on 16.04
There is another way to change the association. It is via using Ubuntu-tweak.
Install Ubuntu tweak
Open it via Dash by typing "Ubuntu tweak"
After opening it, Click on the Admin tab.
Then click on File type manager section
Then first select the Text catagory from the left side bar, and then click on the Associated Applications column to sort it by Application name
After the application is sorted by name, Select the top entry with Gedit, then Press and hold the Shift key and click on the last entry with gedit. Then click on the Edit button.
A new window will open where you can see all installed text editor.
Then select the desired application from list and click close. You can also Click on the Add button to add an application which is not installed in pre-defined system folder.
Hope this will help. If you want to reset them, you can click the reset button also.
The good thing in this solution is, you can't accidentally mess up your system .desktop file.
The easiest way to do is using the nautilus files not sure if it works for others too
select the type of file you want right click and select properties (Alt+Enter is the shortcut)
The choose the option open with and then select the one you want as you see here I use atom by default you can also select sublime from the recommended applications
Command line editor
you you want to choose the default editor in command line type the following command and then choose the option from there
since I use vi I have set it to vim you can choose what ever you want from there also here is the screen shot
If you like this don't forget to vote up this post
Screenshot of setting
Sublime Text
as default application:Note: If you right click on a
*.c
file and if you do the above process, then only those files which have the same extension will have the new application as a default one. So similarly you should do the same for all kinds of files. Eg:*.cpp
,*.py
etc.