This section is a quick reference of many common vi commands. Some of these were discussed earlier in the chapter, while many will be new.
Table 16-1. Movement
Operation | Key |
---|---|
left, down, up, right | h, j, k, l |
To the end of the line | $ |
To the beginning of the line | ^ |
To the end of the file | G |
To the beginning of the file | :1 |
To line 47 | :47 |
Table 16-2. Editing
Operation | Key |
---|---|
Removing a line | dd |
Removing five lines | 5dd |
Replacing a character | r |
Removing a character | x |
Removing ten characters | 10x |
Undo last action | u |
Join current and next lines | J |
Replace old with new, globally | %s'old'new'g |