Skip to content

Instantly share code, notes, and snippets.

@mafredri mafredri/subl.sh
Last active Aug 29, 2015

Embed
What would you like to do?
Extended subl for SublimeText to open *.sublime-project files if available.
# Detect and open sublime-project files in the provided path, if no parameters
# are provided, open the $PWD. If the parameter is not a directory, call subl
# normally.
_subl() {
local params="$*"
local project
if test -z "$params"; then
params=.
fi
if test -d "$params"; then
project=$(ls "$params"/*.sublime-project 2>/dev/null) 2>/dev/null
if test -n "$project"; then
command subl --project "$project"
else
command subl "$params"
fi
else
command subl "$@"
fi
}
alias subl="_subl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.