Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim temporary disable undo?

Tags:

vim

plugins

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 ?

like image 613
Payne Chu Avatar asked May 30 '26 03:05

Payne Chu


1 Answers

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.

like image 137
Ingo Karkat Avatar answered May 31 '26 17:05

Ingo Karkat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!