vim temporary disable undo?

北城余情 提交于 2019-12-20 02:42:24

问题


I followed add-custom-header-to-your-file to create my own custom header plugin. When I save the file it will auto. update the current date time to Last-Modified field. But this will add a edit history to undo list. How can I disable the undo temporary ?


回答1:


You cannot disable undo without losing the undo history. Think about the undo implementation; would be pretty hard if you had a gap in there.

If you don't worry about losing the history,

:set undolevels=-1

(and then restoring to the previous value) will do. Also, :undojoin can be used to fuse two otherwise separate entries together. But in your situation, it's probably best to keep the (automated) change inside the undo history.



来源:https://stackoverflow.com/questions/17969784/vim-temporary-disable-undo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!