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

后端 未结 10 581
花落未央
花落未央 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:47

    Also check out :undolist, which offers multiple paths through the undo history. This is useful if you accidentally type something after undoing too much.

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

    Vim documentation

    <Undo>      or                  *undo* *<Undo>* *u*
    u           Undo [count] changes.  {Vi: only one level}
    
                                *:u* *:un* *:undo*
    :u[ndo]         Undo one change.  {Vi: only one level}
    
                                *CTRL-R*
    CTRL-R          Redo [count] changes which were undone.  {Vi: redraw screen}
    
                                *:red* *:redo* *redo*
    :red[o]         Redo one change which was undone.  {Vi: no redo}
    
                                *U*
    U           Undo all latest changes on one line.  {Vi: while not
                moved off of it}
    
    0 讨论(0)
  • 2021-01-29 17:53

    Practically speaking, the :undolist is hard to use and Vim’s :earlier and :later time tracking of changes is only usable for course-grain fixes.

    Given that, I resort to a plug-in that combines these features to provide a visual tree of browsable undos, called “Gundo.”

    Obviously, this is something to use only when you need a fine-grained fix, or you are uncertain of the exact state of the document you wish to return to. See: Gundo. Graph your Vim undo tree in style

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

    In command mode, use the U key to undo and Ctrl + r to redo. Have a look at http://www.vim.org/htmldoc/undo.html.

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