7.A.2: Making Changes | 7: Editing Files | 7.a: Using vi |
To edit a file, start at the prompt and issue the
vi
command followed by the name of the file:
> vi sample.doc
vi
. Then you use the vi subcommand :n
to edit the next file, or :e!
to edit the previous file. If
you lose track of where you are, use :f
to show your current
file.)
The vi subcommands to move around are the same as in view. Try these:
[return] | scrolls one line at a time |
^f (ctrl+ f) | scrolls forward a page |
^b | scrolls back a page |
w | move forward a word |
b | move back a word |
G | Go to end of file |
0 | Go to beginning of file |
Now that you know how to get started and get around in vi, let's actually make a couple of changes.
7.A.2: Making Changes | 7: Editing Files | 7.a: Using vi |