Sublime Forum

Undo chain command

#1

Hi all,

I have several custom key bindings in which I use the chain command. Sometimes I press a key binding unintentionally. To be able to revert back to before pressing the key binding, I have to undo multiple times. Sometimes I even undo too many times, which is annoying. Is there a way to undo all the chain commands with a single undo, as a macro does?

Any thoughts or suggestions are appreciated.

0 Likes

#2

The chain command can run any arbitrary command. So it’s not possible to undo the whole chain. There’s an open issue for it https://github.com/sublimehq/sublime_text/issues/4141

So currently if you want to undo everything, you’d have to create a wrapper plugin TextCommand around those commands or just use a macro instead.

0 Likes

#3

@UltraInstinct05, thank you for pointing out the issue that was created on Github.

My understanding is that there are some commands that macros cannot run, but the chain command can. I will try to convert the key bindings to macros and see if they work.

My knowledge of Python or plugins is very limited, but thank you for the explanation.

0 Likes