Sublime Text handler for firefox in Ubuntu

02 Jul 2014

Better errors is a pretty good gem for debugging. It comes with live REPL on the error page which makes debugging lot easier. You can inspect the variable right from the error page with the REPL and even you can switch the context in the stack frame.

Another best thing is you can open the file right from the browser in Sublime Text.

Better Errors.

When you click on the filename app/controllers/home_controller.rb (the one marked on the above image) it open the file, in your editor. But in order to this work on ubuntu, you need to register a handler for it.

To register the handler, copy the below code into a file and save it somewhere the shell can find it.

#!/usr/bin/env bash

request=${1:23}               # Delete the first 23 characters
request=${request//%2F//}     # Replace %2F with /
request=${request/&line=/:}   # Replace &line= with :
request=${request/&column=/:} # Replace &column= with :
subl $request                 # Launch ST2

I saved this in ~/bin since ~/bin is already availabe in my $PATH. Make sure you have given that file and executable permission.

After saving the handler, when you click on filename (shown in the image above), firefox will ask to point out the handler for subl.


Click on choose and select your handler. Make sure you check the “remember my choice” option so that firefox won’t ask the same again.

Easy debugging.

If you find my work useful, I appreciate donations via PayPal.
comments powered by Disqus