Skip to content

Instantly share code, notes, and snippets.

@mathieugagne
Created June 27, 2013 02:32
Show Gist options
  • Save mathieugagne/5873526 to your computer and use it in GitHub Desktop.
Save mathieugagne/5873526 to your computer and use it in GitHub Desktop.
Source: http://stackoverflow.com/a/14775172/2033014
Step 1
Create the file /usr/share/applications/sublime-handler.desktop
[Desktop Entry]
Name=Sublime Text 2 URL Handler
GenericName=Text Editor
Comment=Handle URL Scheme txmt://
Exec=/home/<your_user>/bin/sublime-handler %u
Terminal=false
Type=Application
MimeType=x-scheme-handler/txmt;
Icon=sublime-text-2
Categories=TextEditor;Development;Utility;
Name[en_US]=Sublime Text 2 URL Handler
Step 2: Update the MIME-types database
$ sudo update-desktop-database
Step 3: Create the ~/bin/sublime-handler file
#!/usr/bin/env bash
request=${1:23} # Delete the first 23 characters
request=${request//%2F//} # Replace %2F with /
request=${request//%40/@} # Replace %40 with @
request=${request/&line=/:} # Replace &line= with :
request=${request/&column=/:} # Replace &column= with :
sublime-text-2 $request # Launch ST2
Then make it executable :
$ chmod +x sublime-handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment