Skip to content

Instantly share code, notes, and snippets.

@danrabinowitz
Forked from mslinn/s
Created March 27, 2014 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danrabinowitz/9810245 to your computer and use it in GitHub Desktop.
Save danrabinowitz/9810245 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Assumes you have defined subl command
# See http://www.sublimetext.com/docs/2/osx_command_line.html
# See http://www.sublimetext.com/forum/viewtopic.php?f=4&t=10473
if [ "$1" ]; then # open given file(s) or directory/directories
subl "$@" &
else # no arguments
PRJ=`ls -1 *.sublime-project 2> /dev/null`
if [ "$PRJ" ]; then # At least one project exists in current folder, open them all
for P in "$PRJ"; do
subl --project "$P" &
done
else # no file specified and no projects available so open current directory
subl . &
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment