inter.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 1,140 行 · 第 1/3 页
GML
1,140 行
.*
.* (c) Copyright 1992 by WATCOM International Corp.
.*
.* All rights reserved. No part of this publication may be reproduced or
.* used in any form or by any means - graphic, electronic, or mechanical,
.* including photocopying, recording, taping or information storage and
.* retrieval systems - without written permission of WATCOM Publications
.* Limited.
.*
.* Date By Reason
.* ---- -- ------
.* 11-aug-92 Craig Eisler initial draft
.*
:CHAPTER id='inter'.Intermediate Usage
This chapter discusses a number of the commonly used features of &edname.
:PERIOD.
The knowledge of the information in the chapter
:HDREF page=no refid='basic'.
is assumed.
:SECTION.The Command Line
&edname has a powerful set of commands that are entered in a special
command window. These commands
are referred to as &cmdline commands. You can activate the command window
in two ways:
:OL.
:LI.Select the
:HILITE.Enter command
item under the
:HILITE.Control
menu.
:LI.Press the colon (':') key when in &cmdmode
:PERIOD.
Remember to press the
:HILITE.ESC
key to ensure that you are in &cmdmode
before pressing ':'.
:eOL.
Once you have done one of the previous things, the following window will
appear on your screen:
:PICTURE file='cmdenter' text='Command Entry Window'.
You may enter a command in this window (for example: quit). If you wish
to cancel the command that you are typing, just press the
:HILITE.ESC
key and the window will disappear.
:P.
You may cursor back and forth in the command window, and use the
backspace and delete keys to change mistakes. Once you press
:HILITE.ENTER
:CONT.,
the command will be processed.
:P.
If you cursor up, you will go through a list of commands
that you have entered at the command window (newest to oldest). This
is your command
:ITALICS.history
:PERIOD.
Cursoring
down will take you through the history from oldest to newest. This is
very useful if you have typed a complicated command and did not get it
quite right or if you just wish to execute the command again.
:P.
The chapter
:HDREF refid='cmds'.
describes the &cmdline in more detail.
:SUBSECT.Line Numbers
Some &cmdline commands accept a line address or a line range as a
parameter.
For example, when specifying the
:KEYWORD.write
command, you may specify
:ILLUST.
:write
:eILLUST.
or you may specify
:ILLUST.
:1,10 write
:eILLUST.
:P.
A line address is a number or a sum of numbers. As well,
some special symbols may be used:
:DEFLIST.
:DEFITEM.. (dot)
Represents the current line number.
:DEFITEM.$ (dollar)
Represents the last line number.
:DEFITEM.'a (front quote)
Indicates the line with the mark 'a' set; marks 'a' through 'z'
may be used. Marks are discussed later in this chapter.
:eDEFLIST.
:P.
A line range is two line addresses separated by a comma.
:P.
Some examples of line addresses and line ranges are:
:ILLUST.
.+5 - five lines past the current line.
:bILLUST.
'a - the line with mark a.
:bILLUST.
$ - the last line
:bILLUST.
1,5 - lines 1 to 5
:bILLUST.
.,$ - current line in file to end line of file
:bILLUST.
.-3,100 - the line 3 before the current to line 100
:eILLUST.
Line addresses are discussed in greater detail in the section
:HDREF refid='lineadd'.
:PERIOD.
:P.
If you just enter a line address on its own on the &cmdline, then
you will go directly to that line.
:eSUBSECT.
:EXERCISES.
:OL.
:LI.Start up &edname, and try selecting the
:HILITE.Control
menu, and then selecting the
:HILITE.Enter command
item. Notice how the window pops up. Try typing and cursoring around.
When you are done, press the
:HILITE.ESC
key to cancel the command.
:LI.Make sure that you are in &cmdmode, then press the colon (':') key.
Once again, the command window pops up.
Try typing and cursoring around. When you are done, press the
:HILITE.ESC
key to cancel the command.
:LI.Add 10 lines to your file. Then press the colon (':') key and
enter the number 5. You will go to line 5. Try entering different
numbers and see what happens. If you enter a line number that
does not exist, you will see the message:
:ILLUST.
No such line
:eILLUST.
:LI.Now that you have a number of commands entered, try cursoring up
and down in the command window. You will see all the commands that
you have typed.
:eOL.
:eEXERCISES.
:SECTION.Getting a File for Editing
In the chapter
:HDREF refid='basic' page=no.
:CONT.,
you saw that you could edit a file by either specifying the name on the
command line when invoking &edname, or by selecting the
:HILITE.File
menu and picking the
:HILITE.Edit new file
option.
:P.
The general way to edit a new file is to use the &cmdline command
:KEYWORD.edit
:PERIOD.
To enter this command, make sure that you are in &cmdmode and press
the colon (':') key. Once the command prompt is displayed, then
simply type
:KEYWORD.edit
(optionally followed by a file name or a list of files), and then press
:HILITE.ENTER
:PERIOD.
:P.
If you do not specify a file, then a directory listing is displayed.
:INCLUDE file='fsdesc'.
:P.
You may also specify one or more files after the
:KEYWORD.edit
command.
If a file you specify is the same as one already being edited,
then control is simply transferred to the window with that file.
:EXERCISES.
:OL.
:LI.Start up &edname without any files specified. Then try entering the
&cmdline command
:KEYWORD.edit
without any parameters (remember to press the colon (':') key first).
You will see a screen similar to the following:
:PICTURE file='filesel' text='File Selection Display'.
Try changing to other directories or drives
with this list. When you are done, press the
:HILITE.ESC
key to cancel the selection list.
:LI.Try entering the following &cmdline
:ILLUST.
:e afile
:eILLUST.
This will cause &edname to start editing a new file called "afile".
:LI.Try entering the command
:ILLUST.
:e bfile cfile
:eILLUST.
This will cause &edname to edit two new files, one named "bfile"
and one named "cfile".
:LI.Enter the command
:ILLUST.
:e afile
:eILLUST.
This returns you to the first file ("afile") that you were already editing.
:LI.Press
:HILITE.CTRL_C
:CONT., and &edname will quit all the files that you have started editing.
:eOL.
:eEXERCISES.
:SECTION.Moving Between Files
There are a number of ways to move between files that you are editing.
As you have seen in the previous section, you can move to a file
that you are already editing by using the &cmdline command
:KEYWORD.edit
and specifying the name of the file you wish to move to.
:P.
You may press the
:HILITE.F1
key while in &cmdmode or &tinsmode
:PERIOD.
This function key moves you to the next file in the list of files that
you are editing.
:P.
You may press the
:HILITE.F2
key while in &cmdmode or &tinsmode
:PERIOD.
This function key moves you to the previous file in the list of files that
you are editing.
:P.
The previous two function keys that you may use also have &cmdline
equivalents.
The &cmdline command
:KEYWORD.next
moves you to the next file in the list of files that you are editing.
:P.
The &cmdline command
:KEYWORD.prev
moves you to the previous file in the list of files that you are editing.
:P.
It is also possible to display a list of all files that you are currently
editing. You may press the
:HILITE.F7
key in either &cmdmode or &tinsmode, or enter the &cmdline command
:KEYWORD.files
:PERIOD.
Doing any one of these things will cause a list of all files currently
being edited to appear. An asterisk ('*') will precede files that
have been modified.
From this list, you may go to one of the files,
quit one of the files, or save one of the files then quit it.
:EXERCISES.
:OL.
:LI.Start up &edname in the following way:
:ILLUST.
vi a b c
:eILLUST.
This will cause you to edit three new files.
Now, press the
:HILITE.F7
key. The following will appear:
:PICTURE file='files' text='Current File List'.
Select the file
:HILITE.b
:PERIOD.
That file will become the current file being edited.
:LI.Type the &cmdline
:ILLUST.
:files
:eILLUST.
You will see the same result as you saw in the previous example.
Press the
:HILITE.ESC
key to cancel this display.
:LI.Press the
:HILITE.F1
key several times. You will rotate through the three files that you
are editing.
:LI.Press the
:HILITE.F2
key several times. You will rotate through the three files that you
are editing, but in the opposite order than when you were pressing the
:HILITE.F1
key.
:LI.Use the &cmdline commands
:KEYWORD.next
and
:KEYWORD.prev
to move through the files. These commands behave the same as
pressing
:HILITE.F1
and
:HILITE.F2
:PERIOD.
:LI.Press
:HILITE.CTRL_C
:CONT., and &edname will quit all the files that you have started editing.
:eOL.
:eEXERCISES.
:SECTION id='maiaf'.Moving Around in a File
You have already learned to use the cursor keys to move around through
a file. When you are in &cmdmode, there are a number of keys that
also cause movement through the file. Many of these keys may be
preceded with a repeat count. You enter the repeat count
by typing a number (which will be echoed in a special window on the
screen).
:P.
Once you have entered the repeat count, you may cancel it
by pressing the
:HILITE.ESC
key, or you may follow it with a movement command. For example, if
you type:
:ILLUST.
3<Down Arrow Key>
:eILLUST.
you will move down three lines instead of one.
:P.
The basic &cmdmode movement commands are:
:INCLUDE file='basicmv'.
:P.
There are additional commands that move you around the file which do not
require your fingers to move off the home row of your keyboard.
For a touch typist, this is a great advantage.
For a list of all of the movement commands, see the section
:HDREF refid='mvement'
in the chapter
:HDREF page=no refid='modes'
:PERIOD.
The following list of movement commands move you around on the
current line:
:DEFLIST.
:DEFITEM.$ (dollar sign)
Move to the end of the current line.
:DEFITEM.0 (zero)
Move to the start of the current line.
:DEFITEM.b
Move backwards to the previous word on the current line. If preceded
with a repeat count, you move back that many words.
:DEFITEM.h
Move right through the text.
If preceded with a repeat count, then you move right that many characters.
:DEFITEM.l
Move left through the text.
If preceded with a repeat count, then you move left that many characters.
:DEFITEM.w
Move forward to the next word on the current line. If preceded
with a repeat count, you move forward that many words.
:DEFITEM.B
Move backwards to the previous whitespace delimited word on the current line.
If preceded with a repeat count, you move back that many words.
:DEFITEM.W
Move forward to the next whitespace delimited word on the current line.
If preceded with a repeat count, you move forward that many words.
:eDEFLIST.
:P.
The following list of movement commands move you to other lines:
:DEFLIST.
:DEFITEM.CTRL_B
Move back one page in the text.
If preceded with a repeat count, you will move back that many pages.
:DEFITEM.CTRL_D
Move down one half page in the text.
If preceded with a repeat count, then you move forward that many lines.
As well, any future
:HILITE.CTRL_D
or
:HILITE.CTRL_U
commands issued will move that many lines, instead of a half page.
:DEFITEM.CTRL_F
Move forward one page in the text.
If preceded with a repeat count, you will move forward that many pages.
:DEFITEM.CTRL_U
Move up one half page in the text.
If preceded with a repeat count, then you move backwards that many lines.
As well, any future
:HILITE.CTRL_U
or
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?