home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

9.5 Multiwindow Editing

To create a new window in nvi , you use a capitalized version of one of the ex editing commands: Edit , Fg , Next , Previous , Tag or Visual . (As usual, these commands can be abbreviated.) If your cursor is in the top half of the screen, the new window is created on the bottom half, and vice versa. You then switch to another window with [CTRL-W] :

<preface id="VI6-CH-0">
<title>Preface </title>

<para>
Text editing is one of the most common uses of any computer system, and
<command>vi</command> is one of the most useful standard text editors
on your system.
With <command>vi</command> you can create new files, or edit any existing
UNIX text file.
</para>
ch00.sgm: unmodified: line 1

# Makefile for vi book
#
# Arnold Robbins

CHAPTERS = ch00_6.sgm ch00_5.sgm ch00.sgm ch01.sgm ch02.sgm ch03.sgm \
	ch04.sgm ch05.sgm ch06.sgm ch07.sgm ch08.sgm
APPENDICES = appa.sgm appb.sgm appc.sgm appd.sgm

POSTSCRIPT = ch00_6.ps ch00_5.ps ch00.ps ch01.ps ch02.ps ch03.ps \
	ch04.ps ch05.ps ch06.ps ch07.ps ch08.ps \
Makefile: unmodified: line 1

This example shows nvi editing two files, ch00.sgm and Makefile . The split screen is the result of typing nvi ch00.sgm followed by :Edit Makefile . The last line of each window acts as the status line, and is where colon commands are executed for that window. The status lines are highlighted in reverse video.

The windowing ex mode commands and what they do are described in Table 9.1 .


Table 9.1: nvi Window Management Commands
Command Function
bg

Hide the current window. It can be recalled with the fg and Fg commands.

di [splay ] b [uffers ]

Display all buffers, including named, un-named, and numeric buffers.

di [splay ] s [creens ]

Display the filenames of all backgrounded windows.

Edit filename

Edit filename in a new window.

Edit /tmp

Create a new window editing an empty buffer. /tmp is interpreted specially to create a new temporary file.

fg filename

Uncover filename into the current window. The previous file moves to the background.

Fg filename

Uncover filename in a new window. The current window is split, instead of redistributing the screen space among all open windows.

Next

Edit the next file in the argument list in a new window.

Previous

Edit the previous file in the argument list in a new window. (The corresponding previous command, which moves back to the previous file, exists in nvi ; it is not in UNIX vi .)

resize ±nrows

Increase or decrease the size of the current window by nrows rows.

Tag tagstring

Edit the file containing tagstring in a new window.

The [CTRL-W] command cycles between windows, top to bottom. The :q and ZZ commands exit the current window.

You may have multiple windows open on the same file. Changes made in one window are reflected in the other, although changes made in nvi 's insert mode are not seen in the other window until after you finalize the change by typing [ESC] . You will not be prompted to save your changes until you issue a command that would cause nvi to leave the last window open upon a file.


Previous: 9.4 Initialization Learning the vi Editor Next: 9.6 GUI Interfaces
9.4 Initialization Book Index 9.6 GUI Interfaces

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru