Skip to content

Instantly share code, notes, and snippets.

@nulldef
Created June 10, 2019 07:38
Show Gist options
  • Save nulldef/2c3bf48fb16a0736fe211ce7be8d5af2 to your computer and use it in GitHub Desktop.
Save nulldef/2c3bf48fb16a0736fe211ce7be8d5af2 to your computer and use it in GitHub Desktop.
Delete opened files sublime plugin
import sublime
import sublime_plugin
import os
class DeleteOpenedFileCommand(sublime_plugin.TextCommand):
def run(self, edit):
file_path = self.view.file_name()
ok = sublime.ok_cancel_dialog("Really remove?", "Yeah, baby!")
if ok:
self.view.close()
os.remove(file_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment