Vim 7.3的一个新功能是“持久性撤销”,它允许在退出缓冲区时将非自由特征保存到文件中.
不幸的是,我还没有完全启用它,或者我必须使用它错了.这是我到目前为止所尝试的内容:
set undofile " Save undos after file closes set undodir=$HOME/.vim/undo " where to save undo histories set undolevels=1000 " How many undos set undoreload=10000 " number of lines to save for undo
在此之后,我应该能够打开任何文件,编辑它,然后保存 – 关闭它,当我再次打开它时,我应该能够撤消/重做,好像我永远不会离开.不幸的是,情况似乎并非如此,因为从未编写过任何未发送的文件.
笔记:
>我使用的Vim 7.3使用来自Vim无奶油项目的Win 7.持久撤消是烘焙的.
> $HOME / .vim / undo存在于我的文件系统中
将它放在你的.vimrc中,如果它不存在则创建一个undodir并启用持久撤消.在Windows和Linux上都经过测试.
" Put plugins and dictionaries in this dir (also on Windows) let vimDir = '$HOME/.vim' let &runtimepath.=','.vimDir " Keep undo history across sessions by storing it in a file if has('persistent_undo') let myUndoDir = expand(vimDir . '/undodir') " Create dirs call system('mkdir ' . vimDir) call system('mkdir ' . myUndoDir) let &undodir = myUndoDir set undofile endif