Last active
December 21, 2020 23:20
-
-
Save pabloasanchez/f6eb5755b55ed5f4fbe4b43b1805c0ac to your computer and use it in GitHub Desktop.
Sublime Text 3 Plugin: Close all saved tabs
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
# Place inside Data\Packages\User | |
# Run: view.run_command("close_saved") | |
import sublime | |
import sublime_plugin | |
class CloseSavedCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
activeWindow = sublime.active_window() | |
views = sublime.Window.views(activeWindow) | |
for each in views: | |
if each.is_dirty() == False: | |
print("Dirty: " + str(each.is_dirty())) | |
print("Closing " + each.file_name()) | |
each.close() |
Thank you for this handy script. I had to fix a minor bug in the code to make it work.
You're welcome, friend. I'm glad you found it useful. Also thank you for the bug fix!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this handy script. I had to fix a minor bug in the code to make it work.