在 Sublime 中检测编辑器退出事件 [英] Detecting editor exit events in Sublime
问题描述
有没有办法在 Sublime 2 中检测编辑器退出事件?
Is there a way to detect editor exit event in Sublime 2?
它未列在 API 参考 中,我已尝试使用 EventListener.on_close
,但这仅适用于检测视图关闭,这不是我需要的.
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?
推荐答案
在 ST2 中没有办法做到这一点.在 ST3 中,您可以尝试使用 sublime_plugin.EventListener.on_window_command()
,或者可能是 on_text_command()
(不确定 exit
是哪种命令,为了安全起见,可能两者都做),但我自己从未尝试过.
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.
这篇关于在 Sublime 中检测编辑器退出事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!