I had a very large (14 digit) decimal number in my (Windows) clipboard. I had vim open in normal mode on the command line at the time. Accidentally, I pressed some key/mouse combination that caused vim to repeat a write command many times. vim was not responding for a while (I'm assuming it started a huge disk write). I killed vim. After opening the file, I saw that it was appending some text (in vim's clipboard) to my file over and over again (I should have executed something like
After deleting these lines and the swap file (I deleted the swap file because vim was complaining about it whenever I open the file), I found that the undo file had become very large (~700MB). Now, as soon as I launch vim, it does a lot disk reads and is slowing down everything else. I appears to hog my CPU and memory too (CPU usage was constantly above 25%, disk was upto 85% and memory was above 90%). I can't use anything else for some time as it reserves a large buffer in memory. Exiting vim has also become very slow.
I'm still new to vim, and I don't know how to safely lower the size of the undo file (I don't want to forget the entire undo history because of this one thing). I opened the
.un~ file to see what's wrong, it looked like this,
It occurs to me that each line in this file maintains one command (or old content) in the past history (because scrolling past this line took a very long (CPU) time). I don't know if vim is logging the actual content or just the command.
Please explain what has happened and how to fix this.