sponsor Vim development Vim logo Vim Book Ad

undofile_warn.vim : Warn when using the undofile.

 script karma  Rating 1/1, Downloaded by 677  Comments, bugs, improvements  Vim wiki

created by
Martin Tournoij
script type
Homepage: http://arp242.net/code/undofile_warn.vim


The 'undofile' is a great feature, and I use it a lot. However, one annoyance
is that it's very easy to accidentally undo changes that I did the last time I
opened the file; which may be 2 minutes ago, an hour ago, last week, or a
year ago.
So what would happen is that sometimes I would accidentally undo changes from
ages ago.

This plugin fixes that by showing a warning.

I originally posted this as an answer on vi StackExchange, which also has some
other solutions to the same problem:

This plugin overwrites the `u` and `CTRL-R` mappings:

    nmap u     <Plug>(undofile-warn-undo)
    nmap <C-r> <Plug>(undofile-warn-redo)

You can prevent this by setting `g:undofile_warn_no_map` to 1.

g:undofile_warn_mode (Boolean, default: 1)

0 Show a warning for a second but don't actually change behaviour.
1 Show a warning and do nothing on the first u press, confirm with pressing u again.
2 Ask for explicit confirmation
install details

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
download-from-homepage.tar.gz 1.0 2016-10-30 7.0 Martin Tournoij Download from homepage.
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github