Wikia

Vim Tips Wiki

Changes: Undo and Redo

Edit

Back to page

m (Reverted edits by 196.46.120.125 (talk | block) to last version by JohnBot)
(With a capital R, the command is incorrect.)
 
(11 intermediate revisions by 7 users not shown)
Line 13: Line 13:
 
To undo recent changes, use the undo command:
 
To undo recent changes, use the undo command:
 
*<code>u</code>: undo last change (can be repeated to undo preceding commands)
 
*<code>u</code>: undo last change (can be repeated to undo preceding commands)
*<code>Ctrl-R</code>: Redo changes which were undone (undo the undos). Compare to '<code>.</code>' to ''repeat'' a previous change, at the current cursor position. Ctrl-R will redo a previously undone change, wherever the change occurred.
+
*<code>Ctrl-r</code>: Redo changes which were undone (undo the undos). Compare to '<code>.</code>' 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:
 
A related command is:
Line 28: Line 28:
 
==References==
 
==References==
 
*{{help|undo}}
 
*{{help|undo}}
  +
*{{help|U}}
   
 
==Comments==
 
==Comments==
<code>Ctrl-R</code> means to hold down the <code>Ctrl</code> key then press the <code>R</code> key. Note that you do not press the <code>Shift</code> key. Vim documentation uses traditional computer terminology including CTRL-R. In keeping with a more modern approach, we generally use "Ctrl" rather than "CTRL" on this wiki. The tips are not entirely consistent regarding whether to write Ctrl-R or Ctrl-r, but mostly Ctrl-R is preferred. [[User:JohnBeckett|JohnBeckett]] 10:04, March 18, 2010 (UTC)
+
nnoremap U :echo " < < ===== C H E C K C A P S L O C K ===== > > "<CR>

Latest revision as of 15:18, October 28, 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 alsoEdit

ReferencesEdit

CommentsEdit

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

Around Wikia's network

Random Wiki