diff --git a/closeondelete.py b/closeondelete.py new file mode 100644 index 0000000..79747ce --- /dev/null +++ b/closeondelete.py @@ -0,0 +1,14 @@ +import sublime_plugin +import sublime +import os + + +class MyEvents(sublime_plugin.EventListener): + def on_activated(self, view): + if view.is_dirty(): + return + filename = view.file_name() + if not os.path.exists(filename): + view.set_scratch(True) + sublime.set_timeout(lambda: view.window().run_command("close_file"), 0) +