问题
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