Making a Sublime Command Link for OSX
I’ve just switched back to using a Mac platform and started using Sublime as my text editor of choice. In the past I’ve used TextMate, but Sublime has met all of my needs easily including single file edits, project folder edits, context display for languages, and good quick response.
One thing I love to do is to work in the shell (Terminal) and work among the folder structure for things line Vagrant projects. In order to launch my text editor from the command line, there is a simple trick to creating a shortcut to Sublime which is done like so:
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
You’ll be prompted for your password unless you’ve already type it into your shell, but the result should be successful as shown above with no errors displayed. Next you can browse to a folder where you have a file you want to edit and you can use the simple command
sublime FILENAME to launch the editor with your file already loaded:
This will launch a Sublime window loaded with your Vagrantfile in this case:
Loading a folder as a project is also just as easy. In this case, we have a folder with 3 files in it for my sample:
By launching Sublime with the command line
sublime . you will load the folder which displays all of the files in the editor for simple multi-file edits:
It’s just that easy! Happy editing!