After I installed the fantastic better_errors gem, I was disappointed to notice that linking to your text editor doesn't work correctly on Ubuntu (at least, it didn't for me). Here's how I fixed it.
First, create a new desktop entry:
# /usr/share/applications/subl-urlhandler.desktop
[Desktop Entry]
Version=1.0
Name=Sublime Text 2
Name[en_PH]=Sublime Text 2
Exec=/usr/bin/subl-urlhandler %u
Icon=/opt/subl/Icon/48x48/sublime_text.png
Terminal=false
Type=Application
Categories=Development;
StartupNotify=true
MimeType=x-scheme-handler/subl;
Next, let's create the script we're linking to.
#!/bin/bash
# /usr/bin/subl-urlhandler
# $1 is formatted like subl://open?url=file://%2Fpath%2Fto%2Ffile.txt&line=xx
# Strip off subl://open?url=file://
file=${$1#*file*//}
# Strip off &line=...
file=${file%&line=*}
# Decode URL
file=$(echo $file | sed -e 's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e)
# Strip off everything but what's after &line=
line=${$1#*line=}
# Launch sublime
subl $file:$line
Finally, reload your desktop files by running: sudo update-desktop-database
.
Now you should be good to go! I hope this helped!
I had to do somehtin like
to make it work.