(→See also: explain links) |
(Undo revision 37665 by 14.139.38.10 (talk) not consistent with other uses in the page, and badly formatted) |
||
(17 intermediate revisions by 11 users not shown) | |||
Line 12: | Line 12: | ||
}} |
}} |
||
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) |
⚫ | |||
⚫ | |||
⚫ | |||
+ | A related command is: |
||
− | Note that (somewhat confusingly) <tt>U</tt> is undo-able with <tt>u</tt>. |
||
⚫ | |||
+ | |||
+ | <code>U</code> is not actually a true "undo" command as it does not actually navigate undo history like <code>u</code> and <code>CTRL-R</code>. This means that (somewhat confusingly) <code>U</code> is itself undo-able with <code>u</code>; it creates a ''new'' change to reverse previous changes. |
||
+ | |||
+ | <code>U</code> is seldom useful in practice, but is often accidentally pressed instead of <code>u</code>, so it is good to know about. |
||
==See also== |
==See also== |
||
Line 24: | Line 28: | ||
==References== |
==References== |
||
*{{help|undo}} |
*{{help|undo}} |
||
+ | *{{help|U}} |
||
==Comments== |
==Comments== |
||
+ | nnoremap U :echo " < < ===== C H E C K C A P S L O C K ===== > > "<CR> |
||
− | <tt>Ctrl-R</tt> means to hold down the <tt>Ctrl</tt> key then press the <tt>R</tt> key. Note that you do not press the <tt>Shift</tt> 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) |
Revision as of 16:20, 7 July 2014
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
- 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.
References
Comments
nnoremap U :echo " < < ===== C H E C K C A P S L O C K ===== > > "<CR>