Textmate2 save on lost focus
Frage
In TextMate v1, there was an option to save on lost focus. That is, when you'd switch to another application, your TextMate documents would save. How can I recreate this behavior in TextMate 2?
Lösung
There is a plugin for TextMate 2 that allow you to save on focus lost : Save-On-Focus-Lost, just install the plugin and you will have the feature back even in TexMate 2.
Andere Tipps
The way to do this has changed as of alpha.9495. From the README at the Save-On-Focus-Lost repo:
You can now set saveOnBlur in .tm_properties to make TextMate save files when focus is lost.
...Using .tm_properties also allows to easily target specific file types, for example one could use:
[ ui/**.php ] saveOnBlur = true
This would then only have .php files in the ui folder auto-save when focus is lost.
This is also really nice because it makes it possible to set this as a project-specific setting.
But if you want to set it as a global setting, edit the file ~/Library/Application Support/TextMate/Global.tmProperties
and add the line saveOnBlur = True
near the beginning, before any lines with filetype-specific settings.
Edit the file: ~/Library/Application Support/TextMate/Global.tmProperties
and add the line:
saveOnBlur = true
The Global.tmProperties file is only loaded on startup so you need to save all changes, exit and re-run TextMate for this to take effect.
The plugin: https://github.com/bomberstudios/Save-On-Focus-Lost.tmbundle works for me in mavericks but the path to the bundles is different than the one outlined in the instructions on github.
I think bundles are installed in: /Library/Application Support/Avian/Bundles in TextMate2
Cloning there the bundle (git clone https://github.com/bomberstudios/Save-On-Focus-Lost.tmbundle.git) worked fine.
The saveOnBlur setting only works for a file that has been saved at least once. That is, a file that exists on disk. If you test it by opening a new temporary file, typing something then switching away and back again, the file will not be saved because there is no file on disk. Save the temporary file then test. It should work.