How to undo all changes in a buffer made since it was open in Vim?

后端 未结 7 755
执念已碎
执念已碎 2021-01-30 08:38

How can I undo all changes since opening a buffer? I imagine there may be some form of :earlier that does this.

Update: Many are suggesting

7条回答
  •  北荒
    北荒 (楼主)
    2021-01-30 09:25

    You can use the

    :edit!
    

    command to get into the earliest saved state. See :help edit! for more information.

    You can also check something like gundo.vim (can be found here), which displays the whole undo tree graphically, and you can easily jump between points. Then there is the histwin plugin which I did not used yet, but offers similar functionality.

提交回复
热议问题