(Undo revision 26758 by 57.70.21.242 (talk) CTRL-R instead of CTRL-r is consistent with the :help and the rest of the wiki) |
(Undo revision 38973 by 87.133.84.242 (talk) um, no. Standard undo command is just "u". No CTRL required.) Tag: sourceedit |
||
(28 intermediate revisions by 15 users not shown) | |||
Line 6: | Line 6: | ||
|complexity=basic |
|complexity=basic |
||
|author= |
|author= |
||
− | |version= |
+ | |version=6.0 |
|rating=631/256 |
|rating=631/256 |
||
− | |category1= |
+ | |category1=Getting started |
− | |category2= |
+ | |category2=Undo |
}} |
}} |
||
− | To undo recent changes, use the |
+ | 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== |
||
+ | *[[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== |
==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> |
Revision as of 17:30, 24 March 2016
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>