How to disable Session Saving in Sublime Text 2?
Sublime Text 2 is a great text editor and software development buddy for almost any kind of programming language and environment. I use it primarily for PHP, JavaScript and HTML (with JSON, YAML, INI files too).
On top of being able to synchronize my settings across all my working environments through Dropbox, I was able to manage and switch projects easily.
One great feature was that Sublime Text 2 allows you to exit without saving changes, and when you re-open it your changes will re-open unsaved. This allows you to quickly close Sublime Text 2 without "Do you want to save your file?" prompts and without worry that you will lose changes when you hit the switch. This feature is called "hot_exit". Nifty feature and name.
However, this got annoying for me when my workspaces get synchronized across Dropbox and errors start to show up because I place files on different locations when on different computers.
So in order to disable session saving i.e. whenever you open Sublime Text 2 your workspace will be empty, you will have to set the following in your user settings (Preferences > Settings - User):
{
"hot_exit": false,
"remember_open_files": false
}
While remember_open_files
is the main setting to clear the workspace, it requires hot_exit
to be turned off. Hope that helps!
Written by Sam-Mauris Yong
Related protips
3 Responses
You do not need to do this when syncing with Dropbox. The information about the currently open files is stored in one of the folders in the Sublime Text 2 directory. Therefore, you can symlink those three directories and leave one of them local to the machine you are working on. Specifically, you only need to sync the "Installed Packages", "Packages" and the "Pristine Packages" directories. Do NOT sync the "Settings" directory.
On windows:
mklink /d "Installed Packages" "path\to\dropbox\Installed Packages"
mklink /d "Packages" "path\to\dropbox\Packages"
mklink /d "Pristine Packages" "path\to\dropbox\Pristine Packages"
On Linux:
ln -s path/to/dropbox/Installed\ Packages Installed\ Packages
ln -s path/to/dropbox/Packages Packages
ln -s path/to/dropbox/Pristine\ Packages Pristine\ Packages
this is correct too.
@sticklyman it's all ok, if you don't want sync your settings :) it's the case