Editing Flashcards
How do you replace ‘foo’ with ‘bar’ on the current line?
:s/foo/bar/g
How do you replace ‘foo’ with ‘bar’ in the entire file?
:%s/foo/bar/g
How do you delete the current XML/HTML tag and all its contents?
dat
How do you repeat the last editing action?
Press the ‘.’ key.
How do you start editing a new line above/below the current cursor?
O/o
How do you jump to the beginning/end of the file?
gg/G
How do you open a file for editing?
:e
How do you write the buffer to a file?
:w []
How do you delete/replace the character under the cursor?
x/r
How do you move to the next start/end of a word?
w/e
How do you move to the start/end of a line?
0/$
How do you undo/redo?
u/Ctrl-r
How do you copy/paste?
y/p
How do you move the current cursor position to the middle/top/bottom of the screen
zz/zt/zb
How do you search forward/backward for , and then move to next/prev occurences?
”/”/”?” to search, then n/N