The sublime-project is a file that contains all settings for a specific project. The file as to be loaded each time you relaunch Sublime Text.
To avoid that, we are going to launch Sublime Text from terminal with a parameter that is this sublime-project file name.
Sublime Text bring a CLI tool subl, but we can't used the CLI tool as it is. To use it, we need to do a symbolic link.
Assuming you've placed Sublime Text in the applications folder
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
The
lnis a command utility to create link to an existing file. The option-sis used to create a symbolic link. It's an alias.
The/binfolder is a directory in Unix systems that contains the executable programs.
We name our link sublime to be more explicit.
Now we can run Sublime Text just by typing sublime in our terminal.
Definition /bin
Doc Unix
Doc Sublime Text
Tutorial by Olivier Lacan
Now we need to tell to Sublime Text to use the current sublime-project file when we hit sublime in terminal. For this we will add a parameter that will be the name of our sublime-project file.
Go to your project folder
cd /path/to/your/project
Then create a .bashrc file
touch .bashrc
Open the freshly created file and copy paste this code
# [...]
function project_aware_subl {
project_file=$(ls *.sublime-project 2>/dev/null | head -n 1)
sublime ${*:-${project_file:-.}}
}
alias sublime="project_aware_subl"
# [...]
Now, from the terminal, at the root of your project, we can hit sublime your_project.sublime-project and Sublime Text will launch with the project-sublime file loaded.
Pretty cool, isn't it? 😎