vi Editor commands

        1G
        |
0 -------------$
        |
        G

l - forward one character
h - back one character

k - up one line
j - down one line

w - forward one word
b - back one word

$ - end of line
0 - zero - start of line

G - bottom line
nG - move to line n

Editing modes

a - Append after cursor
i - insert before cursor

r - replace character
R - Overtype charachers

u - undo last change
U - Undo all changes

o - open new linebelow
O - open new line above

J - Join line below to line above

Saving and exiting

:w - save, use existing name
:wq - save and quit
:q - Just quit if doc saved
:q! - Quit even if unsaved changes
:w <filename> - Save with new filename
:r <filename> - read in file, start at current cursor position
Ctrl-g - Check currnet name of file

Searching

/<word> - search for <word> forward
?<word> - search backwards for <word>
n - next match of search
N - previous match of search

Copy, paste, change and delete

x - delete current cursor
dd - delete or cut whole line
dw - delete or cut current word
d2w - delete or cut two words
yy - yank (copy) whole line
y3w - yank 3 words
p - paste after cursor
P - Paste before cursor
cw - change word
cc - change entire line
c4l - change next four characters.


rb/vicommands.txt · Last modified: 10/10/2013 14:21 (external edit)