vim 7.3的一个新功能是“持久撤销”,允许在退出缓冲区时将undotree保存到文件。不幸的是,我没有能够得到它正确启用,或者我必须使用它错了。这里是我到目前为止所尝试,
set undofile " Save undo's 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
在这之后,我应该应该能够打开任何文件,编辑它,然后保存关闭它,当我再次打开它,我应该能够撤消/重做,如果我从来没有离开。不幸的是,这似乎是不一样的,因为没有undofile是写的。@H_403_2@
笔记:@H_403_2@
1)我在win7使用vim 7.3从vim没有膏霜项目。 persistent-undo被烘焙。@H_403_2@
把它放在你的.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