txmt:// protocol and Sublime Text 2

When I’m coding a Rails app, I use the better_errors Gem which, as its name says, display “better” Rails errors ^^

And I noticed that this Gem create some links as txmt://open?url=...

If you didn’t guess, this open the concerned file into TextMate.

So, I figured that it could be cool to be able to open this kind of links with SublimeText2 on Ubuntu (no luck, my Google searches give only solutions for OSX or Windows).

Challenge Accepted

I thus had to manage to make it work on Ubuntu.

And you know what? … I made it !! (at the same time, I wasn’t going to write an article to say that I didn’t success…)

Step 1 : Create a .desktop file

Create the file /usr/share/applications/sublime-handler.desktop

Well, I copied the ST2 .desktop file and modified it (most important part is the Exec and the MimeType)

Don’t forget to replace <your_user> with the good one.

Step 2 : Update the MIME-types database

$ sudo update-desktop-database

Step 3 : Create the sublime-handler file

So, you need to create the file ~/bin/sublime-handler

Save the file, the make it executable $ chmod +x sublime-handler

And voilà, there is no more than testing. Click one a txmt:// link and see if it works.

And if it doesn’t work, too bad for you. (more seriously, if it doesn’t work, contact me and say me what is wrong. Maybe I forget a step…)

Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">