How do I do redo (i.e. “undo undo”) in Vim?

后端 未结 10 588
花落未央
花落未央 2021-01-29 16:53

In Vim, I did too much undo. How do I undo this (that is, redo)?

相关标签:
10条回答
  • 2021-01-29 17:32

    First press the Esc key to exit from edit mode.

    Then,

    For undo, use u key as many times you want to undo.

    For redo, use Ctrl +r key

    0 讨论(0)
  • 2021-01-29 17:34

    Using VsVim for Visual Studio?

    I came across this when experimenting with VsVim, which provides bindings for Vim commands in Visual Studio.

    I know about Ctrlr in Vim itself, but this particular binding does not work in VsVim (at least not in my setup?).

    What does work however, is the command :red. This is a little bit more of a hassle than the above, but it is still fine when you really need it.

    0 讨论(0)
  • 2021-01-29 17:36

    Ctrl+r

    0 讨论(0)
  • 2021-01-29 17:44

    Refer to the "undo" and "redo" part of Vim document.

    :red[o] (Redo one change which was undone) and {count} Ctrl+r (Redo {count} changes which were undone) are both ok.

    Also, the :earlier {count} (go to older text state {count} times) could always be a substitute for undo and redo.

    0 讨论(0)
  • 2021-01-29 17:45

    Use :earlier/:later. To redo everything you just need to do

    later 9999999d
    

    (assuming that you first edited the file at most 9999999 days ago), or, if you remember the difference between current undo state and needed one, use Nh, Nm or Ns for hours, minutes and seconds respectively. + :later N<CR> <=> Ng+ and :later Nf for file writes.

    0 讨论(0)
  • 2021-01-29 17:46

    CTRL+r

    The "r" is lower-case.

    0 讨论(0)
提交回复
热议问题