Skip to content

Instantly share code, notes, and snippets.

@clipperhouse
Last active January 1, 2020 10:35
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 clipperhouse/d0a68423096a502015dd to your computer and use it in GitHub Desktop.
Save clipperhouse/d0a68423096a502015dd to your computer and use it in GitHub Desktop.
Open Sublime Text in current Finder folder

First you need subl at the command line. Use this:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

...which came from Sublime's documentation here.

Next, open (Apple)Script Editor and paste this in:

tell application "Finder"
	set currentDir to (target of front Finder window) as text
end tell
do shell script "subl " & (quoted form of POSIX path of currentDir)

Go to File → Export... and choose File Format: Application and save it as an .app.

Now navigate to that new app in the Finder, and command-drag (⌘-drag) the app into the Finder's toolbar. Right-click the Finder toolbar to customize or rearrange.

(This app opens the folder that the Finder is in. It ignores selection.)

screenshot

Oh, optionally, if you want the Sublime icon: Get Info (⌘-i) on the Sublime app in the Finder, click the icon in the Get Info window, and ⌘-c to copy. Do the same on your new .app, and paste instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment