VI Commands:
Code Library, Linux Apache Server April 25th, 2007VI is like a text editor for linux command line, SSH, telnet etc not unlike notepad for windows.
VI Commands:
i                insert mode, (ESC to exit insert mode) allows text to be entered on the screen
a                         Append to right mode
/word                Move to the occurrence of “wordâ€
n                         Locate the next occurance
w                        Advance to the next word
e                         Advance to the next end of a word
b                   Move to the previous word
3b                      Move backward 3 words
dd                      delete line
3dd                    delete 3 lines
DÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Delete remainder of a line
dw                      Delete word
x                        Delete character
o                        Open space for new line below the cursor line
OÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Open a line above the cursor
CTRL-w           Move back a word in append mode
u                        Undo last
UÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Undo all changes to current line
.                         In command mode, repeat the last text changing the command on the current line
:w newfilename      save the file to newfilename from the command mode
:wq                    save and quit
:q!                     quit without saving
r                        replace then typa a character ot be replaced with r then return to break up a line
JÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â join 2 lines
s                        substitute (sentence) typed text over a character, ESC when done
cw                     change word
c                        change part of a line from the cursor to the end of the line
cc                      substitute new text for aline, ESC when done
h                        move the cursor back one space
HÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â move the cursor to the highest line on the screen
LÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â move the cursor to the lowest line on the screen
MÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â position the cursor at the midpoint on the screen
GÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â last line in the file
0 (zero)Â Â Â Â Â Â Â Â Â Move the cursor to the beginning of the line it is on
view filename    Open a file for viewing only
set number       Turn on line numbers
set nonumber    Turn off line numbers
Options:
number
autoindent (ai)Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ctrl-d to move to the left
showmatch                match brackets and parenthesis
tabstop=4
wrapmargine(wm) Â Â Â Â Â Â when line is wrapped (80-value)
:2 copy 4Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Place a copy of line 2 after line 4.
:1,4 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â copy 7 (lines 1-4)
:n                                     Access the next file for editing
Del.icio.us
Furl
Newsvine
Netscape
StumbleUpon
Technorati
Squidoo
Windows Live
Yahoo MyWeb
Ask
Google