| File
commands |
| Quit |
:q |
if file is saved |
| :wq |
save & quit |
| :q! |
quit without saving |
| Save |
:w |
|
| Save As |
:w file |
|
| Open |
:e file |
if current file is saved |
| :e! file |
without saving current file |
| Insert File |
:r file |
below current line |
| Edit
commands |
| Undo |
u |
last change |
| U |
changes in current line |
| Mark Beginning of Block |
mx |
set mark x (x may be any letter) |
| Mark End of Block and ``Copy'' |
y`x |
yank from here to mark x into buffer |
| Mark End of Block and ``Cut'' |
d`x |
delete from here to mark x into buffer |
| ``Paste'' * |
P |
put buffer before cursor |
| p |
put buffer after cursor |
| Delete Character |
x |
|
| Delete Line |
dd |
|
| Join Line with Next Line |
J |
|
| Search commands |
| Search Forward |
/string |
|
| Search Backward |
?string |
|
| Repeat Last Search |
n |
|
| Replace, query each |
:,$s/string1/string2/gc |
enter y Return or Return |
| Replace all |
:,$s/string1/string2/g |
|
| Navigation commands |
| Left, Right, Up, Down |
h , l , k , j |
arrow keys may also work |
| 1 Screen Forward, Backward |
Ctrl-f , Ctrl-b |
|
| Beginning, End of File |
1G , G |
|
| Beginning, End of Line |
0 , $ |
|
| Go to Line number |
:number or number G |
|