Bug 20054

Summary: Vim has persistent undo by default now (was: Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename>)
Product: Mageia Reporter: Marja Van Waes <marja11>
Component: RPM PackagesAssignee: Thierry Vignaud <thierry.vignaud>
Status: RESOLVED OLD QA Contact:
Severity: normal    
Priority: Normal Keywords: FOR_RELEASENOTES6, UPSTREAM
Version: Cauldron   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: vim-8.0.133-2.mga6 CVE:
Status comment:

Description Marja Van Waes 2017-01-01 12:39:34 CET
After creating or editing a file with vim, when you save it a large .*.un~ file is created (or overwritten when it already exists), like this:

[marja@localhost ~]$ ls -al | grep test
-rw-r--r--  1 marja marja       7 jan  1 11:59 test
-rw-r--r--  1 marja marja      15 jan  1 12:07 test2
-rw-r--r--  1 marja marja       8 jan  1 11:59 test2~
-rw-r--r--  1 marja marja     541 jan  1 12:07 .test2.un~
-rw-r--r--  1 marja marja     523 jan  1 11:59 .test.un~
[marja@localhost ~]$

The first time I became aware this happens, was some time after vim stopped enabling selecting text with the mouse by default.

The oldest one that I can find, now, is this one:

-rw-r--r--  1 marja marja    2063479 sep 23 11:27 .timezone.txt.un~

That file is from after vim-8.0.5-1.mga6 was pushed. 

I'm not sure it didn't already happen with vim-8.0.3, but am sure it did not happen before vim-8.0.3.
Marja Van Waes 2017-01-01 12:40:25 CET

Summary: Since vim-8.0.3 or 8.0.5, vim creates large .<filename>.un~ files when it saves <filename> => Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename>

Comment 1 Marja Van Waes 2017-01-01 13:53:32 CET
Apparently default vim behaviour was changed from not having "persistent undo" to having it.
http://stackoverflow.com/questions/15660669/what-is-a-un-file-or-or-why-does-vim-in-the-terminal-make-the-un-file

It does indeed work: I can undo changes now that were made before I last saved the file.

Persistent redo seems to work, too: undoing a change, saving the file, and then redoing it with ctrl+R, works.

I never missed this feature, though :-þ

If we keep it as default, then we should add it to the release notes (both for those who might be delighted to have it, and for those who won't be too happy with it)
Marja Van Waes 2017-01-01 13:54:34 CET

Summary: Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename> => Vim's has persistent undo by default now (was: Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename>)

Marja Van Waes 2017-01-01 13:55:28 CET

Summary: Vim's has persistent undo by default now (was: Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename>) => Vim has persistent undo by default now (was: Since vim-8.0.3 or 8.0.5, vim also writes a large .<filename>.un~ file when it saves <filename>)

Comment 2 Marja Van Waes 2017-01-07 15:41:33 CET
To revert this to previous behaviour

(only keep a " <filename>~ " backup of the previous time the file was saved) add:

    set noundofile
    set backup

to your ~/.vimrc

Keywords: (none) => FOR_RELEASENOTES6, UPSTREAM

Comment 3 Marja Van Waes 2021-06-23 12:22:16 CEST
Closing, everyone will have gotten used to the new default

Resolution: (none) => OLD
Status: NEW => RESOLVED