15

From the help zuw *zug* *zuw* zug Undo |zw| and |zg|, remove the word from the entry in 'spellfile'. Count used as with |zg|. zuW *zuG* *zuW* zuG Undo |zW| and |zG|, remove the word from the internal word list. Count used as with |zg|.


8

The change list is a different thing from the undo list. The change list is a list of locations of changes, and it can be viewed with :changes and navigated with e.g. g; and g,. The g+ and g- commands that you’re using move instead through the undo list. This is a tree of different file states: it’s what you are navigating when you undo and redo changes. The ...


4

Using :saveas keeps the undo history intact. :saveas is equivalent to the combination of :w newname followed by :e #. I usually find it more handy than the :w + :e, especially since with :saveas it's not really possible to forget about doing the second command and end up editing the first file. (Which you can guess is something I've done more than once!)


4

Original vi only supports single-level undo: the first time you press u it performs an undo, and the second time you press it it undoes the undo, going back to the state before the undo. Nvi (and possibly other implementations of vi) allow you to perform more undoes first by pressing u, and then by pressing . to repeat the undo operation. Vim augments undo ...


3

Typically, Vim considers a mapping or a recorded macro as a single change, so if you press u to undo it, it will undo all of it. There exists the possibility to break an undo-sequence into smaller parts, so that you can undo each part of it independently. For that, the generic way is to enter CTRLGu in Insert mode. (See :h i_CTRL-G_u). So simply add CTRLGu ...


2

I use argdo in this answer, same rule applies to bufdo, windo , ... . Don't use argdo undo argdo undo failes in these conditions: Some buffers remain unchanged after last argdo, might caused by 0 pattern match, execute undo on them is a mistake, it will undo changes made by older argdo. An error occurs during your last argdo, when an error occurs, argdo ...


2

Doing :let &ul=&ul breaks the undo sequence. This is documented under :h :undojoin: Setting the value of 'undolevels' also breaks undo. Even when the new value is equal to the old value. Using the described method, you can do the following: nnoremap <leader>d dd:let &ul=&ul<CR>dd


1

Tim Pope created eunuch plugin with such feature. It has :Move and :Rename commands. Do not know if it works under Windows since description is about UNIX shell commands, can't test it right now. Also as filbranden said you can copy with :saveas.


1

I found what the problem was. It was caused by a plugin: auxiliary/vim-layout I'm not sure why it causes such strange behavior, but I have uninstalled it and now my undo history works fine.


1

The sentence Set 'verbose' to get a message about that when opening a file. Refers to the option verbose—you can tell because it's enclosed in single-quotes, and if you place your cursor on it and press Ctrl-], you jump to the same section as :help 'verbose' would. It's not clear what level of verbosity you would need, but try set verbose=1 and then ...


Only top voted, non community-wiki answers of a minimum length are eligible