2

In ST (Sublime Text for short) the redo action works very strange and inconvenient way, from my point of view.

First test. Type some text, for example

Foo

and then press Ctrl-Y one or several times. You will see:

FooFooFoo

Second test. Again, type something, for example

The cat on the roof.

and then press Backspace to remove the dot at the end of sentence. Okay, and then press Ctrl-Y several times. You will see:

The cat on the ro

It very differs from any text editor/IDE I have used - Brackets, Vim and some more.

Is there some way to fix it?

2 Answers 2

4

The default redo/undo keybindings in ST are:

  • ctrl+z: undo
  • ctrl+shift+z: redo
  • ctrl+y: redo_or_repeat (explained in @MattDMo's answer)
  • ctrl+u: soft_undo this does not only undo text changes, but also cursor movements. This can be very useful if you jumped somewhere and want to go back or added a selection you did not want.
  • ctrl+shift+u: soft_redo

Hence the keybinding you want ist ctrl+shift+z.

However if you want to map it to ctrl+y, you can open Preferences >>> Keybindings - User and paste the following:

[
    {
        "keys": ["ctrl+y"],
        "command": "redo"
    }
]
1
  • 1
    In Mac, use "super+y".
    – Safwan
    Oct 28, 2018 at 1:58
0

CtrlY is not a shortcut for redo, it's a shortcut for "repeat last action". Perform some actions, then click on the Edit menu and see what the menu option for ^Y says. It will most likely say something like "Repeat Insert Characters" if you've just been typing, or "Repeat Left Delete" if you've just been hitting Backspace. It's meant to be used in conjunction with CtrlZ or "Undo last action". For example, you select some text and hit Delete, only to realize you selected too much. You can then hit CtrlZ to undo the delete, and CtrlY to repeat the delete action.

1
  • @johnc.j. ctrl+shift+z is the hotkey for redo
    – r-stein
    Apr 18, 2016 at 13:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .