Last active
November 24, 2019 17:00
-
-
Save NickWoodhams/434e185ce543ca1c8a99 to your computer and use it in GitHub Desktop.
Close Deleted File - Sublime 3 Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime_plugin | |
import sublime | |
import time | |
import os | |
class MyEvents(sublime_plugin.EventListener): | |
def on_deactivated_async(self, view): | |
s = view.file_name() | |
if s: | |
time.sleep(0.1) # Give the file time to be removed from the filesystem | |
if not os.path.exists(s): | |
print("Closing view", s) | |
view.set_scratch(True) | |
view.window().run_command("close_file") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Michael!
Here is improved version:
It resolved conflict with settings editor.