How do you save your undo history in VIM after exiting?

I have been leaving my script open in VIM in one PuTTY session and then testing it in another session after writing. That way if my changes break something, I still have my undo history.

Is there any way to get persistent undo without upgrading to VIM 7.3?

It looks like you can use

    :set hidden

to save it when switching buffers, but saving your undo history after exiting VIM isn't build in until 7.3. Anyone know of a simple workaround?


You can't. Vims persistent undo was introduced with version 7.3. There exists an unofficial patch to make use of persistent undo using vim 7.2, but several bugs in persistent undo mode have been fixed since the release of vim 7.3


You can either use a multiplexer like screen or tmux which is a good idea for all sorts of reasons or you can simply stop quitting vim:

  • Make and save your changes
  • Press ctrl-z
  • Test the changes you made
  • Enter fg on the shell prompt to get back to your vim session.
  • 链接地址: http://www.djcxy.com/p/8706.html

    上一篇: 如何在不移动光标的情况下移动屏幕?

    下一篇: 退出后,如何在VIM中保存撤消历史记录?