Vim Tips Wiki
(move U help topic to be an actual link in the references section)
Line 25: Line 25:
 
*[[Recover from accidental Ctrl-U]], which explains what constitutes a '''change''' which can be undone.
 
*[[Recover from accidental Ctrl-U]], which explains what constitutes a '''change''' which can be undone.
 
*[[Using undo branches]], which explains Vim's unique and very powerful '''undo tree'''.
 
*[[Using undo branches]], which explains Vim's unique and very powerful '''undo tree'''.
 
U
 
   
 
==References==
 
==References==
 
*{{help|undo}}
 
*{{help|undo}}
  +
*{{help|U}}
   
 
==Comments==
 
==Comments==

Revision as of 17:18, 5 March 2014

Tip 39 Printable Monobook Previous Next

created 2001 · complexity basic · version 6.0


To undo recent changes, use the undo command:

  • u: undo last change (can be repeated to undo preceding commands)
  • Ctrl-R: Redo changes which were undone (undo the undos). Compare to '.' to repeat a previous change, at the current cursor position. Ctrl-R will redo a previously undone change, wherever the change occurred.

A related command is:

  • U: return the last line which was modified to its original state (reverse all changes in last modified line)

U is not actually a true "undo" command as it does not actually navigate undo history like u and CTRL-R. This means that (somewhat confusingly) U is itself undo-able with u; it creates a new change to reverse previous changes.

U is seldom useful in practice, but is often accidentally pressed instead of u, so it is good to know about.

See also

References

Comments

nnoremap U :echo " < < ===== C H E C K C A P S L O C K ===== > > "<CR>