+9

Add "save all on loss of focus" option

codex 13 years ago updated by Stevan C Wing 12 years ago 9
This is useful when interacting with tools outside of the editor.
FWIW there is a save_on_focus_lost setting, although it only saves the current file, rather than all files

save_on_focus_lost saves files when focus is lost, not only from sublime, but also when you switch to other files inside sublime, so I don't understand how can you have unsaved changes anywhere else except on the current file.

+2

In my workflow, I make some changes to several files, then run a build and test run in an external window.  If each file is saved on loss of individual focus, then I have to wait until my long test run finishes before trying something else, lest I break the run by changing a file and then switching to another file, thereby saving it.  If I had point-in-time consistent saves on loss of focus, I could save all files and continue making changes without worrying about corrupting the existing run.

+1

The title and comments are misleading. 

The issue here is adding an option to change what triggers lost focus event.

Didn't understand what you want here...
Like Jon said, save_on_focus_lost already exists and must meet your requirement.

With this settings, every time you change the edited file or ST2 lost focus it save the current file.
This mean that I don't see a way to have a not saved file other than the current one, and it will be saved when ST2 lost focus.

This settings look useless...
+1
I would like to save *all* modified files on loss of focus, not just the current file.

Ahhh I apologise — thanks Jon — that's just what I need.


I hadn't noticed that setting.


Thanks very much! 

+6
The current implementation of save_on_focus_lost is sufficient for some, but not for all people. I like to see another option that saves all documents when Sublime loses focus, similar to how TextMate behaves.

The problem with the current implementation is, that it saves to often. For example: I develop Python code an the server automatically reloads if a file changes. When I'm editing a project with multiple files, I will often switch between files (to look things up or write new functions), but some files might be in a broken state. When I switch to another file with save_on_focus_lost my server will reload and crash.

I hope this makes it a bit more clear why a second save on focus option is necessary.
I agree. I usually have a test server running with a growl notification to show me if there were any errors. Saving too often can be very annoying. 

In this context if the behaviour was Similar to TextMate that would be marvellous.