Skip to content

Instantly share code, notes, and snippets.

@ArtiomL
Created December 20, 2014 23:20
Show Gist options
  • Save ArtiomL/94c50174142eea1c82dc to your computer and use it in GitHub Desktop.
Save ArtiomL/94c50174142eea1c82dc to your computer and use it in GitHub Desktop.
Sublime Text Plugin - Close Project
# Sublime Text Plugin - Close Project
# (CC0) No Rights Reserved
# Artiom Lichtenstein
# v1.0, 21/12/2014
#
# Key Bindings: { "keys": ["ctrl+shift+0"], "command": "close_project_cmd" }
#
import sublime, sublime_plugin
class CloseProjectCmd(sublime_plugin.WindowCommand):
def run(self):
bol_MODIFIED = False
for tab_CUR in self.window.views():
if tab_CUR.is_dirty():
bol_MODIFIED = True
break
if bol_MODIFIED:
sublime.message_dialog("Please Save Modified Tabs to Close the Project.")
else:
if int(sublime.version()) >= 3000:
self.window.run_command("close_workspace")
else:
self.window.run_command("close_project")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment