I’m trying to find a way to get the last command if it was a successful find and replace operation.
Here’s the code with the commented parts where I have the question.
import sublime, sublime_plugin class UndoFindCommandsAllOpenFiles(sublime_plugin.ApplicationCommand): def run(self): for w in sublime.windows(): self._save_files_in_window(w) def _save_files_in_window(self, w): for v in w.views(): self._file_in_view(v) def _file_in_view(self, v): if v.file_name(): if v.is_dirty(): # If last command is a replace, then do these below... # command_history may work but nothing shows in the console if this is the case. # My goal here is to undo all open files if their last command was a replace one. v.run_command("undo") v.run_command("save")