Search code examples
sublimetext2sublimetextsublime-text-plugin

Detecting editor exit events in Sublime


Is there a way to detect editor exit event in Sublime 2?

It is not listed in the API reference and I've tried using EventListener.on_close, but that works only for detecting view closing, which is not what I need.

I just want to execute something before the editor exits, is that possible?


Solution

  • There is no way to do this in ST2. In ST3, you could try to capture the exit command by using sublime_plugin.EventListener.on_window_command(), or possibly on_text_command() (not sure what kind of command exit is, probably do both for safety), but I've never tried it myself.