inter.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 1,140 行 · 第 1/3 页
GML
1,140 行
This can also be accomplished by pressing the underscore ('_') key.
:P.
If you double click the left mouse button, the current word will be
highlighted and the selection menu will appear. However, the word selected here
is slightly different than the word selected by clicking the right mouse
button. This word is defined to include the characters '.', ':' and '\', so
that double clicking the left mouse button on a file name will select the
entire path.
:EXERCISES.
:OL.
:LI.Edit the file "atest" created in the Exercises section of
:HDREF refid='maiaf'
:PERIOD.
Click the left mouse button when the mouse cursor is on the top line,
and drag your mouse down until the first 10 lines are selected.
If you do not have a mouse, then press the shift key and cursor down
until the first 10 lines are selected.
:P.
Now, click the right mouse button somewhere inside the selected
region. If you do not have a mouse, press the underscore ('_') key. A
menu will appear.
The selected region and the menu will appear as follows:
:PICTURE file='mlsel' text='Selected Lines Menu'.
From this menu, you can either delete or yank (copy) the lines. You
may cancel the menu by pressing
:HILITE.ESC
(the region remains highlighted). You can cancel the selected region by
pressing
:HILITE.ESC
again.
:P.
If you click your left mouse button somewhere outside the selected region,
both the menu and the selected region will be cancelled.
:LI.Make sure the selected region is cancelled (press
:HILITE.ESC
until it is gone).
Now press the right mouse button on the word "This" in the first line of
the file. If you do not have a mouse, then position the cursor somewhere
in the word "This" and press the underscore ('_') key. You will see the following
menu appear:
:PICTURE file='mcsel' text='Selected Columns Menu'.
You may do a number of things from the popup menu:
:DEFLIST.
:DEFITEM.Open
Open (edit) the file indicated by the highlighted (selected) text. The
selected text is treated like a file name, and an edit session for that file is
started. The file will be given the name of the highlighted text.
:DEFITEM.Change
Change the selected word.
:DEFITEM.Delete
Delete the selected word.
:DEFITEM.Yank
Yank (copy) the selected word.
:DEFITEM.Fgrep
Search the current directory for any files containing the selected word.
See the &cmdline command
:KEYWORD.fgrep
in the chapter
:HDREF refid='cmds'.
for more information.
:DEFITEM.Tag
Search your tags file for the selected word.
See the &cmdline command
:KEYWORD.tag
in the chapter
:HDREF refid='cmds'.
for more information.
:eDEFLIST.
:LI.Make sure the selected region is cancelled. Then add the following
line to the start of the file (use the &cmdmode key capital o ('O')
to open a line above the first line):
:ILLUST.
#include <c:\h\test.h>
:eILLUST.
Now, try right mouse clicking on parts of the file name. Notice how
only individual pieces of the file name are selected. Now, try double
clicking the left mouse button somewhere on the file name. The
menu from the previous example will appear, selecting the entire file name
as shown below:
:PICTURE file='mcdcsel' text='Double Click Selection'.
:LI.Try using
:HILITE.CTRL_R
to start a selection and then move around in your file. Use the
:HILITE.ESC
key to cancel your selection.
:LI.Try using the shifted cursor keys to select lines. Use the
:HILITE.ESC
key to cancel your selection.
:eOL.
:eEXERCISES.
:SECTION.Joining Text
&edname has the ability to join two lines together. If you press the
letter 'J' (capital 'j') while in &cmdmode, then the next line will join to the
end of the current line. All white space except for a single space
will be removed. For example, typing 'J' while on the first line in these
two lines:
:ILLUST.
This is a line.
This is another line.
:eILLUSt.
produces the line:
:ILLUST.
This is a line. This is another line.
:eILLUST.
If you precede 'J' with a repeat count, then that many lines after the current
line will be joined to the current line. For example, typing
:ILLUST.
4J
:eILLUST.
while on the first line of:
:ILLUST.
Line 1.
Line 2.
Line 3.
Line 4.
Line 5.
Line 6.
:eILLUST.
will produce the result:
:ILLUST.
Line 1. Line 2. Line 3. Line 4. Line 5.
Line 6.
:eILLUST.
:P.
There is also a &cmdline command called
:KEYWORD.join
that is used to join lines of text together. This command is used
as follows:
:ILLUST.
<linerange> join
:eILLUST.
The lines in the specified range
:HILITE.<linerange>
are joined together. If a single line number is specified, then the
line after that line is joined to the specified line. If no line number
is specified, then the line after the current line is joined to the current
line. For example, the command:
:ILLUST.
:1,5 join
:eILLUST.
will cause the lines 1 through 5 of the file to be joined into a single
line.
:SECTION.Marks
:INCLUDE file='markinfo'.
:P.
A mark is useful in that you do not have to remember a specific line
number, you just need to remember the letter that you picked for the
mark name. You can then return to the line or even the exact position
on the line easily.
:P.
You may set a mark by pressing the letter 'm' (in &cmdmode) and pressing one
of the letters from 'a' to 'z'. For example, if you type
:ILLUST
ma
:eILLUST
you will set the mark 'a' at the current position in the file, and
you will see the following message appear:
:ILLUST.
Mark 'a' set
:eILLUST.
:P.
You can set a mark with the &cmdline command
:KEYWORD.mark
:PERIOD.
The syntax of the command is
:ILLUST.
<line> mark <letter>
:eILLUST.
You specify which line the mark is to be set on with
:HILITE.<line>
:PERIOD.
If no line is specified, the current line is assumed. You specify
the mark id ('a'-'z') with
:HILITE.<letter>
:PERIOD.
:P.
For example, the following &cmdline commands may be used to set marks:
:ILLUST.
mark a - sets the mark 'a' on the current line.
5 mark b - sets the mark 'b' on line 5.
:eILLUST.
:P.
Once you have set a mark, you may return to the mark by pressing either
the front quote (apostrophy) (') or the back quote (`), followed by the
letter of the mark you wish to return to. Using the back quote causes you
to return to the row and column position of the mark.
Using the front quote (apostrophy) causes you to return to the line with the
mark (the cursor moves to the first column on the line).
:P.
For example, after setting the mark 'a', you can return to it by typing:
:ILLUST.
'a - return to the line with the mark 'a'.
`a - return to the exact position with the mark 'a'.
:eILLUST.
:P.
Marks are useful when you need to go searching a file for something,
but you want to be able to return to a specific position. They are
also useful when deleting and copying text (see the section
:HDREF refid='dcapt'.
later on in this chapter).
:P.
For more information on marks, see the section
:HDREF refid='marks'
in the chapter
:HDREF page=no refid='modes'
:PERIOD.
:EXERCISES.
:OL.
:LI.Edit the file "atest" created in the Exercises section of
:HDREF refid='maiaf'
:PERIOD.
Cursor to the letter 'i' in the word 'is' on the first line, and type
:ILLUST.
ma
:eILLUST.
This will set the mark 'a' at that position.
:LI.Page down twice. Now, type
:ILLUST.
`a
:eILLUST.
You will be moved to the 'i' in the word 'is' on the first line.
:LI.Page down twice. Now, type
:ILLUST.
'a
:eILLUST.
You will be moved to the first column of the first line.
:LI.Go to the bottom of the file. Now, enter the &cmdline command
:KEYWORD.mark
as follows (remember to press colon (':') to bring up the command window)
:ILLUST.
:mark z
:eILLUST.
:LI.Go to the top of the file (using CTRL_PAGEUP), and enter the
&cmdline
:ILLUST.
:'z
:eILLUST.
This will return you to the last line of the file
:LI.Now, type the following &cmdline
:ILLUST
:'a
:eILLUST.
This will take you back to line 1, where you set the mark 'a'.
:eOL.
:eEXERCISES.
:SECTION id='stext'.Searching for Text
You can search a file for a string in either a forwards or backwards
direction.
By using the &cmdmode key '/', you are prompted for a string to
search for in the forwards direction. By using the &cmdmode key '?',
you are prompted for a string to search for in the backwards direction.
:P.
When the string is found, your cursor is moved to the first character
of the string, and the string is highlighted.
:P.
If the string (for example, "abc") is not found, you will see the message:
:ILLUST.
String 'abc' not found
:eILLUST.
:P.
When you press '/' (forward search), the following window will appear:
:PICTURE file='srchent' text='Search String Entry Window'.
This window behaves just like the command window:
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. If you press
:HILITE.ESC
:CONT.,
the search in cancelled.
:P.
If you press '?' (backwards search), you will be able to enter a backwards
search string.
:P.
If you press 'n', &edname will take you to the next occurrence of the
last search string, searching in the same direction as the last
search command.
:P.
If you press 'N', &edname will take you to the next occurrence of the
last search string, only it will search in the opposite direction as
the last search command.
:P.
:INCLUDE file='rxexp'.
:P.
The section
:HDREF refid='srching'.
in the chapter
:HDREF page=no refid='modes'.
describes the searching in more detail.
:EXERCISES.
:OL.
:LI.Edit the file "atest" created in the Exercises section of
:HDREF refid='maiaf'
:PERIOD.
Press the forward slash ('/') key, and enter the string "this".
The word "This" on the first line will be highlighted, and your cursor
will be on the 'T'. (notice that the search is case insensitive).
:LI.Now press, the 'n' key. You will move to the word "This" on the
second line.
:LI.Press 'n' two more times. You will now be on the word "This" on
the fourth line.
:LI.Press 'N'. You will move to the word "This" on the third line.
:LI.Press the question mark ('?') key, and enter the string "1". You
will move to the '1' on the first line.
:LI.Press 'n'. The search will wrap around to the end of the file,
and search backwards until the '1' on line 21 is encountered.
:LI.Press 'n'. You will move to the '1' on line 19.
:LI.Press 'N'. You will move back to the '1' on line 21.
:eOL.
:eEXERCISES.
:SECTION id='dcapt'.Deleting, Copying, and Pasting Text
There are two useful commands in &edname for deleting and
copying text. In &cmdmode, you press the 'd' key to start the delete
sub-mode. You press the 'y' key to start the yank (copy) sub-mode. Each
of these sub-modes is indicated on the mode indicator on the menu bar:
:ILLUST.
Mode: delete
:eILLUST
or
:ILLUST.
Mode: yank
:eILLUST
:P.
Once you have entered the sub-mode, you can then specify one of the following
operations:
:INCLUDE file='operlist'.
Some examples are:
:ILLUST.
dw - delete a word
yr - yank (copy) highlighted region
d/text - delete up to the word "text".
:eILLUST.
:P.
These commands can be preceded by an optional repeat count. This repeat
count specifies the number of times that the command will be executed.
If the repeat count is not specified, the command is executed once.
For example:
:ILLUST.
3dw - delete 3 words
2yy - copy 2 lines
:eILLUST.
:P.
A ©buffer can be specified between the repeat count and the command.
The buffer is identified by preceding it with double quotes ("). For
example:
:ILLUST.
3"ayy - copy 3 lines into buffer 'a'.
"zdd - delete 3 lines into buffer 'z'.
:eILLUST.
The optional ©buffer is a place where deleted or yanked text resides. If
you do not specify a buffer, then the active ©buffer is assumed.
There are 9 numbered buffers (1-9) that may be selected as the active
buffer (buffer 1 is the default active buffer). When text enters the
active ©buffer, the old contents of the active buffer spills into the
next buffer. The contents of each buffer spills into the next, with the end
buffer (9) losing its contents.
:P.
The active copy buffer may be selected by pressing
:HILITE.CTRL_F1
through
:HILITE.CTRL_F9
in &cmdmode.
:PERIOD.
When you do this, a message appears showing you which buffer
has been selected, how many lines/characters are in the buffer, and the first
line of the buffer.
:P.
There are also 26 named buffers, 'a' through 'z'. The contents of
these buffers is constant over the life of your editing session. They
retain their contents until you update them.
:P.
For more information on copy buffers, see the section
:HDREF refid='cpybuff'
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?