|
Command
|
Effect
|
|
vi
filename
|
open
a file in the vi
editor
|
|
j
|
Move
down a line
|
|
k
|
Move
up a line
|
|
l
|
Move
right
|
|
h
|
Move
left
|
|
i
|
Insert
text at the cursor – changes to the edit mode use ESC to exit the edit
mode
|
|
a
|
Add
text after the cursor
|
|
o
|
Open
a blank line below the cursor
|
|
ESC
|
Exit
the edit mode
|
|
SHFT
g
|
Move
to the bottom of the file
|
|
-g
|
Report
what line the cursor is line
|
|
:1,10d
|
Delete
lines 1-10
|
|
x
|
Delete
the character the cursor is on
|
|
dd
|
Delete
the line the cursor is on
|
|
/test
|
Search
for test
|
|
:1
|
move
to line one
|
|
:q
|
Quit
vi
|
|
:q!
|
Quit
vi
without saving changes
|
|
:wq
|
Save
file and quit vi
|
|
:%s/test/foo/g
|
Search
for test and replace it with foo
throughout the file.
|