How to associate file types with Sublime Text 2?
I installed Sublime Text using this tutorial http://www.technoreply.com/how-to-install-sublime-text-2-on-ubuntu-12-04-unity/
I want to associate Sublime with css, js and php files. I added the following rows but still when double click on a php, js or css file, it does NOT open it at all (not just with Sublime):
text/php=sublime.desktop
text/x-php=sublime.desktop
application/php=sublime.desktop
application/x-php=sublime.desktop
application/x-httpd-php=sublime.desktop
application/x-httpd-php-source=sublime.desktop
text/javascript=sublime.desktop
text/css=sublime.desktop
How should I proceed?
Solution 1:
This is how I changed the default editor for multiple file types in 12.04:
- Right click the file in question
- Choose 'Properties'
- Select the 'Open With' tab
- Choose 'Sublime Text' under 'Related' or 'Recommended' Applications
- Select 'Set as default' option on the bottom right
If Sublime Text doesn't show up on this list, make sure it's fully installed via the package manager.
Unfortunately I haven't found a way to do this in batch yet and a previous method of opening some hidden file and doing a find and replace for sublime text didn't work for me.
Solution 2:
For Xubuntu. Don't know about Ubuntu or others.
I found this way. And without any command line typing, which is good.
In "File Manager" right click on a file (e.g.
file.conf
) you want to be opened by Sublime Text 2 (or any other application).Choose "Properties". A window titled
file.conf - Properties
should appear.In its tab "General" click "Open With:" and then choose "Other Application...". A window titled
Open With
should appear.At the bottom of this window select "Use a custom command:" option and then "Browse...".
Browse to the necessary executable, Sublime Text 2, for example.
The most important part now: before click Ok
put the selected path into double quotes, e.g.:
"/opt/Sublime Text 2/sublime_text"
because otherwise it cannot accept the path .