Setting up and Configuring Sublime Text 2

Add an "Open In Sublime" Service to the Finder

To Setup the Open in Sublime Text in the Finder, make a new Automator Action, you want to have it run a shell script with the following contents:

Code
/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl -n "$@"

Notice the escapes for the spaces in the application path. The other changes you need to make are:

  • Set "Service receives selected" to "files or folders"

  • Set "in" to "Finder.app"

  • Set "Pass input" to "as argumets"

It should look like this.

This is a placeholder image until aws-20121229-1314-01 is found

Note: There's another way to do this with just using the "Open Finder Items with", but that was advised against. I'm not really sure why, but the above works fine.

Launching Sublime Text from the Command Line

Create a symbolic link to the executable like this:

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

This will let you open a directory in Sublime Text by using the standard dot command:

Code
subl .

Note that you also have a version that links "st"

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

So, you can do:

Code
st .