Sublime Text Macro to Open a Folder

This macro requires the Sublime Text CLI to be configured. I followed the instructions here with a minor modification. Keyboard Maestro does not recognize the command in usr/local/bin so I created it in /usr/bin:

sudo ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/sublime

This provides access to Sublime Text from the terminal on a Mac. My command is

sublime some instructions use the default name subl.

This macro launches Sublime Text with my NVAlt folder as the source:

This macro opens the current Finder folder view in Sublime Text as a source:

Here is the AppleScript portion:

tell application "Finder"

	try

		activate

		set myWindow to folder of front window as string

		set myPath to (get POSIX path of myWindow)

		return myPath

	end try

end tell

Why do it this way? Well, I don’t want to create project files all over my file system. I just want to get a file list in Sublime Text and then use the “Find in Files” functionality (shift-⌘-F).