Skip to content

Instantly share code, notes, and snippets.

@ezos86
Last active August 29, 2015 14:14
Show Gist options
  • Save ezos86/580361d90d05450d5ab0 to your computer and use it in GitHub Desktop.
Save ezos86/580361d90d05450d5ab0 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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