vi Editor commands

0 -------------$

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


/<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: 2013/10/10 14:21 (external edit)