Last active
August 29, 2015 14:15
-
-
Save theWhiteFox/5e40532727b04622733e to your computer and use it in GitHub Desktop.
Learning Vim commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cut and paste: | |
Position the cursor where you want to begin cutting. | |
Press v to select characters (or uppercase V to select whole lines). | |
Move the cursor to the end of what you want to cut. | |
Press d to cut (or y to copy). | |
Move to where you would like to paste. | |
Press P to paste before the cursor, or p to paste after. | |
Copy and paste is performed with the same steps except for step 4 where you would press y instead of d: | |
d = delete = cut | |
y = yank = copy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment