Create a gist now

Instantly share code, notes, and snippets.

@ezos86 /sublime
Last active Aug 29, 2015

Launching Directory from CLI or Terminal with Sublime
#!/bin/bash
DIRECT=$1
if [ ! ${DIRECT} ]; then
echo "Launching Current Directory"
DIRECT='.'
fi
open -a "Sublime Text" $DIRECT -n
@ezos86
Owner
ezos86 commented Jan 31, 2015

Install Directions

Mac OS - Open Terminal

Type.

cd usr/local/bin

Next type.

sudo nano sublime

Then paste the code from the gist into the file. Then hit ctrl+x and then y to confirm you want to save. After this you will need to make the file executable. Still in the 'usr/local/bin' directory.

Type

chmod +x sublime

Now you can type 'sublime' into the command line and specify a directory of if you don't. It will open the current directory in Sublime Text editor. Enjoy!

***NOTE: This is Sublime Text 3 - if you are going to use Sublime Text 2 - Change "Sublime Text" on line 18 to "Sublime Text 2"

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