Last active
August 29, 2015 14:22
-
-
Save mafredri/ce832dcc4e52017e9b62 to your computer and use it in GitHub Desktop.
Extended subl for SublimeText to open *.sublime-project files if available.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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