Skip to content

Instantly share code, notes, and snippets.

@Chovin
Created January 17, 2019 02:57
Show Gist options
  • Save Chovin/e79a7a4400d2c313c840f247ee20f3a9 to your computer and use it in GitHub Desktop.
Save Chovin/e79a7a4400d2c313c840f247ee20f3a9 to your computer and use it in GitHub Desktop.
Open folder/file(s) in sublime w/ a keystroke. Pretty sure I got this from some stackoverflow but not sure where, sorry!
-- Run AppleScript
on run {input, parameters}
tell application "Finder"
set myWin to window 1
set loco to selection
if the number of items in loco is greater than 0 then
set koko to the first item of loco
else
set koko to insertion location
end if
-- at this point, koko is a full path to the selection, or first item of it
-- return koko -- remove the comment, you'll see
set soco to (quoted form of POSIX path of (koko as string)) -- this convert HFS+ format to POSIX format
-- display dialog soco
do shell script "/usr/local/bin/subl -n " & soco
end tell
return soco
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment