-
-
Save trisweb/3d0c26b27cf9123fb2006a1365ce3277 to your computer and use it in GitHub Desktop.
Alias for sublime text to automatically open a project when calling "subl" if a .sublime-project file is found in the current directory. This alias declaration to put in a bashrc file.
This file contains 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
# SublimeText auto-open project in current directory if it exists and argument is . or blank. | |
function project_aware_subl { | |
project_file=$(ls *.sublime-project 2>/dev/null | head -n 1) | |
if [[ ( ! -z "$project_file" ) && ( "${*}" == "." || -z "${*}") ]] | |
then | |
command subl "$project_file" | |
else | |
command subl ${*} | |
fi | |
} | |
alias subl="project_aware_subl" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment