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 3
Name[en_PH]=Sublime Text 3
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
url=$1
# Strip off subl://open?url=file://
file=${url#*file*//}
# Strip off &line=...
file=${file%&line=*}
# Decode URL
file=$(echo $file | sed "s@+@ @g;s@%@\\\\x@g" | xargs -0 printf "%b")
# Strip off everything but what's after &line=
line=${url#*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!