vim临时禁用撤消? [英] vim temporary disable undo?
问题描述
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 ?
推荐答案
您不能在不丢失撤消历史记录的情况下禁用撤消.考虑一下撤消实现;如果您之间有缝隙,那将非常困难.
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
(然后恢复到先前的值)即可.同样,:undojoin
可用于将两个原本分开的条目融合在一起.但是根据您的情况,最好将(自动)更改保留在撤消历史记录之内.
(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.
这篇关于vim临时禁用撤消?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!