且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[20150310]vim persistent undo.txt

更新时间:2022-09-13 10:32:06

[20150310]vim persistent undo.txt

--寻找一个vim插件,上了www.vim.org网站,看到如下一段:

Did you know about persistent undo?

[2014-10-31] A feature I enjoy using myself is not known to many users, as I found out last weekend. Besides undo with
as many levels as you like, Vim also offers storing the undo information in a file. So you can exit Vim, reboot your
computer and still undo changes you made. See the help for 'undofile'. (Bram Moolenaar)

--才发现vim目前支持persistent undo,仔细看了一些文档,设置如下:
--在vimrc文件中加入如下内容,我的测试是windows,linux下也很容易修改.

"重启后撤销历史可用 persistent undo"
set undofile
set undodir=d:\\tmp\\undodir
"maximum number of changes that can be undone"
set undolevels=10000

--手工建立目录d:\tmp\undodir就ok了.
--这样就可以实现即使退出vim,甚至重启机器后,依旧使用undo功能,如果觉得产生的文件多,可以定期删除.