Skip to content

Instantly share code, notes, and snippets.

@vojtajina
Created September 14, 2012 04:34
Show Gist options
  • Save vojtajina/3719802 to your computer and use it in GitHub Desktop.
Save vojtajina/3719802 to your computer and use it in GitHub Desktop.
Shell script to start Sublime Text
#!/bin/sh
# Shell script to start Sublime
# @author Vojta Jina <[email protected]>
if [ -z $@ ]; then
# no arguments, try to find project
# TODO(vojta): traverse up to find projects in parent directories
PROJECT=`ls *.sublime-project 2>/dev/null`
if [ -e "$PROJECT" ]; then
# project exists in current folder, open it
sublime . --project "$PROJECT"
else
# no project, open current folder
sublime .
fi
else
# passing arguments, just forward them to sublime
sublime $@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment