Help :help :help <command>
vimtutorGeneral Startup
To use vi: vi filename gvim filename, behave mswin
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc] To split the windows: :split
Counts A number preceding any vi command tells vi to repeat
that command that many times.
:set number
: set nonumber
ctrl+g
args
Cursor Movement h move left (backspace)
j move down
k move up
l move right (spacebar) [return] move to the beginning of the next line
$ last column on the current line
0 move cursor to the first column on the
current line
^ move cursor to first nonblank column on the
current line
w move to the beginning of the next word or
punctuation mark
W move past the next space
b move to the beginning of the previous word
or punctuation mark
B move to the beginning of the previous word,
ignores punctuation
e end of next word or punctuation mark
E end of next word, ignoring punctuation
H move cursor to the top of the screen
M move cursor to the middle of the screen
L move cursor to the bottom of the screen
set paste
read
write
Find Commands ? finds a word going backwards
/ finds a word going forwards
f finds a character on the line under the
cursor going forward
F finds a character on the line under the
cursor going backwards
t find a character on the current line going
forward and stop one character before it
T find a character on the current line going
backward and stop one character before it
; repeat last f, F, t, T
:set hlsearch
:set nohlsearch
grep
~: change a character's case
ex Commands For a complete list consult the UNIX Programmer's Manual
READING FILES copies (reads) filename after cursor in file
currently editing
:r filename
WRITE FILE :w saves the current file without quitting
MOVING :# move to line #
:$ move to last line of file
SHELL ESCAPE executes 'cmd' as a shell command.
:!'cmd'
:shell