Sublime Forum

Use cases for redo_or_repeat?


Since redo_or_repeat is the default action for Ctrl+Y/Cmd+Y, are there some typical examples of when you would use the repeat part?

For me, the repeat part seems like an entirely different command that doesn’t make sense associated with redo. Like making a function called “save_or_print” that would be bound to Ctrl+S/Cmd+S, which would send your document to the printer if it was already saved. Both functions have a purpose but I don’t understand why you’d tie them together.

Are there some use cases that I’m overlooking where you’d be redoing actions you’ve done and then want to also continue repeating the last action? Or is this more of a way to be economical with hotkeys by assigning two to one? Or is it to lean people towards using Ctrl+Shift+Z as their main/go-to hotkey for redo?



It’s standard behavior:



I wasn’t questioning whether it was standard, just looking for examples of how you would use it.

The example in your link (thanks btw) is repeating a paste operation. But this seems silly since CTRL/CMD+V is even easier to press than CTRL/CMD+Y, especially if you had just pressed that hotkey to paste something right before. I think maybe it would be useful for repeating more complex tasks, but I can’t think of any.

I ask because, since it is the default behavior, I assume people find it useful and do use it, but I can’t find any good examples.

There are some that have issues with it, but no good examples:



I would say its utility is to freak me out. Several times I caught Sublime Text doing weird behavior while doing Ctrl+Y. I only figured out this non-sense when I enabled sublime.log_input(True); sublime.log_commands(True); sublime.log_result_regex(True); sublime.log_indexing(True); and come across this insane redo_or_repeat command which brought me here.

To me, this behavior causes more trouble than helps. Ctrl+Z and Ctrl+Y go back in history and go forward. Not to go forward and beyond doing new things that never existed. I agree that doing some Ctrl+Y after some Ctrl+Z will leave Ctrl+Y with nothing good to do, but it should just do nothing rather than confuse the user.



If you want to redo without repeat the shortcut is ctrl+shift+z. If you want ctrl+y to not repeat you can edit the keybindings under Preferences > Key Bindings.