30.4 Editing Multiple Files with viex commands enable you to switch between multiple files. The advantage is speed. When you are sharing the system with other users, it takes time to exit and re-enter vi for each file you want to edit. Staying in the same editing session and traveling between files is not only faster for access, but you also save abbreviations and command sequences that you have defined, and you keep yank buffers (30.5 ) so that you can copy text from one file to another. When you first invoke vi , you can name more than one file to edit, and then use ex commands to travel between the files: % This edits file1
first. After you have finished editing the
first file, the ex
command You can also switch at any time to another file that you didn't
specify on the command line with the ex
command
vi
"remembers" two filenames at a time as the current and
alternate filenames.
These can be referred to by the symbols
If you have not first saved the current file, vi
will not allow
you to switch files with The command:
is also useful. It discards your edits and returns to the last saved version of the current file. In contrast to the
instead of:
- from O'Reilly & Associates' Learning the vi Editor , Chapter 5 |
|