The solution provided by Anwesha will work but you will have to manually make sublime text your default opening application for all file formats.
What worked for me in 17.10 was the following:
First what you need is the path to the executable file for sublime text
I have ST 3 and it was at
/opt/sublime_text/sublime_text
Then open your terminal and use the following commands:
sudo update-alternatives --install /usr/bin/gnome-text-editor gnome-text-editor /path/to/executablesublime 100
Then enter:
sudo update-alternatives --config gnome-text-editor
This will bring up a list of the available alternatives, where the default is marked by an asterisk. If sublime text is not it, then select it now by entering corresponding number. Make sure sublime-text's priority is the highest.
And you're done! Hope this helps :D
Best Answer
[I see you have asked this question on both SO and AskUbuntu, so I answer here too, but don't know if one of these shouldn't be closed]
I asked me the same question today, seeing the txmt protocol with "better_errors" gem for Rails.
I search a long time but found nothing, so I tried to make it by myself.
I write an article and my blog, but I copy it here, for "future-proofness" :
Step 1
Create the file
/usr/share/applications/sublime-handler.desktop
Step 2: Update the MIME-types database
Step 3: Create the ~/bin/sublime-handler file
Then make it executable :
$ chmod +x sublime-handler
Step 4: Test a txmt:// file
If that dosen't work, say me, I'll try to help you.