Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fvianello/1868621 to your computer and use it in GitHub Desktop.
Save fvianello/1868621 to your computer and use it in GitHub Desktop.
This Applescript take the selected file in Finder and open it with Sublime Text 2 (~/bin/subl). Using Alfred you can bind a global hotkey for this script, so you can edit your files with just a keypress, without worrying about the default editor.
tell application "Finder"
activate
set filePath to (POSIX path of (target of front window as alias))
set fileAlias to the selection as alias
set fileName to name of fileAlias
do shell script "~/bin/subl " & filePath & fileName
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment