Good to go. Close and reopen project to clear all file undo history.
import sublime
import sublime_plugin
class Clear_Undo_Stack(sublime_plugin.ViewEventListener):
def on_load(self):
self.view.clear_undo_stack()
# class clearundoCommand(sublime_plugin.TextCommand):
# def run(self, edit):
# self.view.clear_undo_stack()
# #
# # Warning: Can't clear undo stack from text command
# #
# #obj = self.view
# #for attr in dir(obj):
# # print("obj.%s = %r" % (attr, getattr(obj, attr)))
# #
# # Finds: obj.clear_undo_stack = <bound method View.clear_undo_stack of View(16)>
#
# Open the Python console (Ctrl+`)
# print('\n'*100) to clear screen
# Type: view.run_command("clearundo") and press enter.
API Reference
http://www.sublimetext.com/docs/api_reference.html#ver-dev
Dev Builds Changelog BUILD 4114 3 September 2021
http://www.sublimetext.com/dev
API: Added Buffer.clear_undo_stack()
Please update with: View.clear_undo_stack()