VI Editor
VI Editor
VI Editor
Inserting
r next replace character under cursor with
ignores punctuation
Counts
e A number preceding any vi command tells vi to repeat that command that many times. E H M L h j k l [return] line $ 0 the current line ^ on the current line w word or ( does not work with VT100 type punctuation mark W b previous word move past the next space move to the beginning of the terminals words, or characters ^L redraw screen P ( does not work with Televideo terminals ) p bring back after cursor bring back before cursor move to the beginning of the next move cursor to first nonblank column last column on the current line screen move cursor to the first column on ^F ^B ^D ^U ^R move forward one screen put by move backward one line the p(put) command. Precede with a count for move forward one half screen multiple lines. move backward one half screen yy (yank)'copies' line which may then be move left (backspace) move down move up move right (spacebar) move to the beginning of the next screen db zmove current line to the bottom of delete word before cursor end of next word, ignoring punctuation i move cursor to the top of the screen a append after cursor append at end of line open line above cursor and enter append move cursor to the middle of the screen A move cursor to the bottom of the screen O mode insert before cursor end of next word or punctuation mark
Cursor Movement
Screen Movement
G xG z+ z move to the last line in the file
Deleting
x move to line x dd move current line to top of screen dw move current line to the middle of
delete character under cursor delete line under cursor delete word under cursor
Copying Code
Put Command
redraw screen brings back previous deletion or yank of lines,
% to its mate
SHELL ESCAPE
executes 'cmd' as a shell command.
Find Commands
mx x ? / f finds a word going backwards finds a word going forwards 'x finds a character on the line under the find line marked with character x mark current line with character
:!'cmd'
ex Commands
backward and stop one character before it ; repeat last f, F, t, T For a complete list consult the
Miscellaneous Commands
. u U xp inserts after repeat last command undoes last command issued undoes all commands on one line deletes first character and
WRITE FILE
:w saves the current file without
quitting
MOVING
:# move to line # move to last line of file
^G