Skip to content

Instantly share code, notes, and snippets.

@Baptouuuu
Created January 21, 2019 20:03
Show Gist options
  • Select an option

  • Save Baptouuuu/7d6211904e97faf18c6c2c024069c7f1 to your computer and use it in GitHub Desktop.

Select an option

Save Baptouuuu/7d6211904e97faf18c6c2c024069c7f1 to your computer and use it in GitHub Desktop.
Sublime Handler.app
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>SysPref Handler</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sublime</string>
</array>
</dict>
</array>
on open location this_URL
-- passed urls should be "sublime://[file]
-- @see https://yourmacguy.wordpress.com/2013/07/17/make-your-own-url-handler/
set x to the offset of ":" in this_URL
set file_URL to text from (x + 3) to -1 of this_URL
set cmd to "open -a 'Sublime Text' " & file_URL
do shell script cmd
end open location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment