modes.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 2,044 行 · 第 1/4 页
GML
2,044 行
.*
.* (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
.* ---- -- ------
.* 01-aug-92 Craig Eisler initial draft
.*
:CHAPTER id=modes.Modes
:CMT :SECTION.Introduction
&edname is a modal editor. When you are in &cmdmode
(the default mode), there are a number of valid keys that may be pressed.
To ensure that you are in &cmdmode,
press the
:HILITE.ESC
key until the mode indicator
on the menu bar displays:
:ILLUST.
Mode: command
:eILLUST.
:P.
When in &tinsmode, text may be entered. There are two aspects to
&tinsmode,
:ITALICS.insert
and
:ITALICS.overstrike
:PERIOD.
:KEYWORD.Text insertion mode
is entered via a number of different commands from &cmdmode,
and is indicated by a
larger cursor, along with a mode line indication. The
types of cursor are controlled with the
:KEYWORD.commandcursortype
:CONT.,
:KEYWORD.insertcursortype
:CONT.,
and
:KEYWORD.overstrikecursortype
settings.
:P.
When &edname is in a &tinsmode,
the mode indicator on the menu bar displays one of:
:ILLUST.
Mode: insert
:eILLUST.
or
:ILLUST.
Mode: overstrike
:eILLUST.
.*
.*** Text insertion mode
.*
:SECTION id='timode'.Text Insertion Mode
When in &tinsmode (either inserting or overstriking), you
may enter text and freely cursor about through the file. When you
are finished adding text, the
:HILITE.ESC
key returns you to &cmdmode
:PERIOD.
:P.
It should be remembered that an undo applies to
changes caused by commands; so all changes made while in &tinsmode
are part of a single undo record. For more information on
undos, see the section
:HDREF refid='cmundo'.
later on in this chapter.
:P.
The following keys, when pressed in &cmdmode, place you into &tinsmode:
:DEFLIST.
:DEFITEM.a
Starts appending (inserting) text after the current character in
the edit buffer.
:DEFITEM.A
Starts appending (inserting) text after the last character on the
current line in the edit buffer.
:DEFITEM.C
Changes text from the current position to the end of the current line.
Deletes the text, and enters &tinsmode
:PERIOD.
:DEFITEM.<n>c<oper>
Change command. Deletes the text in the range specified by
:ITALICS.<oper>
:CONT., and enters &tinsmode
:PERIOD.
:DEFITEM.g
Starts inserting or overstriking text at the current cursor position,
depending on how you were adding text the last time you were in &tinsmode
:PERIOD.
:DEFITEM.i
Starts inserting text at the current cursor position.
:DEFITEM.I
Starts inserting text before the first non-white space character on
the current line.
:DEFITEM.o
Opens a line after the current line, and enters &tinsmode
:PERIOD.
:DEFITEM.O
Opens a line before the current line, and enters &tinsmode
:PERIOD.
:DEFITEM.R
Starts overstriking text at the current character in the edit buffer.
:DEFITEM.<n>s
Substitute
:ITALICS.<n>
characters. The first
:ITALICS.<n>
characters from the current cursor position are deleted, and &tinsmode
is entered.
:DEFITEM.<n>S
Substitute lines of text.
:ITALICS.<n>
lines from the current line forward are deleted, and &tinsmode is entered.
:DEFITEM.INS
Start inserting text at the current cursor position.
:eDEFLIST.
:P.
:SUBSECT.Special Keys
While in &tinsmode, certain keys do special things. These keys are:
:DEFLIST.
:DEFITEM.Arrow Keys
:DEFLIST.
:DEFITEM.UP
Cursor up through the text.
:DEFITEM.DOWN
Cursor down through the text.
:DEFITEM.LEFT
Cursor left through the text.
:DEFITEM.RIGHT
Cursor right through the text.
:eDEFLIST.
:DEFITEM.Text Selection Keys
:INCLUDE file='textsel'.
:DEFITEM.CTRL_PAGEUP
Moves to the first non-white space character on the first line
of the current edit buffer.
:DEFITEM.CTRL_PAGEDOWN
Moves to the last character on the last line
of the current edit buffer.
:DEFITEM.SHIFT_DEL
Deletes the currently selected region into the active ©buffer
:PERIOD.
:DEFITEM.SHIFT_INS
Pastes the active ©buffer
into the text after the current position.
:DEFITEM.SHIFT_TAB
Move back to the previous tab stop, deleting the characters before the
cursor.
:DEFITEM.CTRL_DEL (ctrl-delete)
Delete the current line into the active ©buffer
:PERIOD.
:DEFITEM.CTRL_INS (ctrl-insert)
Pastes the active ©buffer into the text before the current position.
:DEFITEM.CTRL_D
Move backwards
:KEYWORD.shiftwidth
spaces, deleting the characters before the cursor. A
:KEYWORD.shiftwidth
is a number that you may set, its default value is 4.
:DEFITEM.CTRL_T
Insert
:KEYWORD.shiftwidth
spaces. If
:KEYWORD.realtabs
is set, then once
:KEYWORD.tabamount
spaces are inserted, the spaces are replaced with a tab character.
:DEFITEM.CTRL_V
The next key typed is inserted directly, without any interpretation.
:DEFITEM.CTRL_Q
The next key typed is inserted directly, without any interpretation.
:DEFITEM.BS
Backspace one on the current line, deleting the character before the
cursor.
:DEFITEM.DEL
Delete the character under the cursor. If you are at the end of the line,
:ITALICS.DEL
has the same effect as pressing
:ITALICS.BS
:PERIOD.
:DEFITEM.ENTER
Start a new line.
:DEFITEM.END
Move to the end of the current line.
:DEFITEM.HOME
Move to the start of the current line.
:DEFITEM.INS
Toggles between insert and overstrike mode.
:DEFITEM.PAGEUP
Move up one page in the text.
:DEFITEM.PAGEDOWN
Move up down one page in the text.
:DEFITEM.TAB
Move forward to the next tab stop. If
:KEYWORD.realtabs
is set, a tab character is inserted into the file. Otherwise, spaces
are inserted.
:eDEFLIST.
:eSUBSECT.
.*
.*** Command mode
.*
:SECTION.Command Mode
The following &cmdmode command descriptions show items within
angle brackets (<>).
The angle brackets are there to indicate items that you may supply.
You are not required to type the brackets. For example, <n> simply
means that in the corresponding place in the command you can enter
a number.
:P.
Many commands may be preceded with a repeat count, which is
indicated by a
:ITALICS.<n>
before a command.
The number is not required; if it is not supplied, it is usually assumed
that a 1 was entered for the repeat count. As long as the setting
:KEYWORD.repeatinfo
is enabled, the number that is typed appears in a special window called the
:KEYWORD.countwindow
:PERIOD.
:P.
Other commands may be preceded with a ©buffer
name, which is indicated with a
:ITALICS.<"?>
:PERIOD.
If you do not want the result of the operation to be copied into the
active buffer, then an alternate buffer may be specified.
The double quotes (")
are required (this indicates that an alternate buffer is being specified),
and then a buffer '1'-'9' or 'a'-'z' is specified. See the section
:HDREF refid='cpybuff'.
for more information.
:CMSECT id='mvement'.Movement
The following are &cmdmode commands that cause movement in the
current edit buffer.
:KEYLIST.
:KEY."|" "<n>|" (or bar)
Move to the column number specified by
:ITALICS.<n>
:PERIOD.
:EXAMPLE.|
Move to column 1 of the current line.
:EXAMPLE.15|
Move to column 15 of the current line.
:KEY.` `<?> (back quote)
Moves to the mark position (line and column) specified by
:ITALICS.<?>
See the section
:HDREF refid='marks'.
for more information.
:SEECMD.mark
:EXAMPLE.`a
Move to the line and column with mark
:ITALICS.a
:PERIOD.
:KEY."'" "'<?>" (front quote)
Move to the start of line with the mark
:ITALICS.<?>
:PERIOD.
See the section
:HDREF refid='marks'.
for more information.
:SEECMD.mark
:EXAMPLE.'z
Move to the start of the line with mark
:ITALICS.z
:PERIOD.
:KEY.'%' '%' (percent)
Moves to matching brace or other defined match string.
Defaults are "{","}"
and "(",")". For example, by pressing
:ITALICS.%
while on the first opening brace ('(') on the line:
:ILLUST.
if( ( i=foo( x ) ) ) return;
:eILLUST.
moves the cursor to the last closing brace (')') on the line.
It is possible to set arbitrary pairs of match strings using the
&cmdline command
:KEYWORD.match
:PERIOD.
:KEY.'$' '$' (dollar)
Moves the cursor to the last character on the current line.
:KEY.'^' '^' (caret)
Moves the cursor to the first non-whitespace character on the current line.
:KEY.';' ';' (semi-colon)
Repeats the last
:HILITE.f
:CONT.,
:HILITE.F
:CONT.,
:HILITE.t
or
:HILITE.T
movement commands.
:KEY.',' ',' (comma)
Repeats the last
:HILITE.f
:CONT.,
:HILITE.F
:CONT.,
:HILITE.t
or
:HILITE.T
movement commands, but the search is done in the opposite direction.
:P.
If the last movement command was an
:HILITE.F
then an
:HILITE.f
movement command is executed.
If the last movement command was a
:HILITE.t
then a
:HILITE.T
movement command is executed.
:P.
Similarly, if the last movement
command was an
:HILITE.f
then an
:HILITE.F
movement command is executed.
If the last movement command was a
:HILITE.t
then a
:HILITE.T
movement command is executed.
:KEY.- <n>- (dash)
Moves the cursor to the start of the previous line. If a repeat count
:ITALICS.<n>
is specified, then you are moved up
:ITALICS.<n>
lines.
:KEY.+ <n>+ (plus)
Moves the cursor to the start of the next line. If a repeat count
:ITALICS.<n>
is specified, then you are moved down
:ITALICS.<n>
lines.
:KEY.0 0
Moves the cursor the first character of the current line.
:KEY.CTRL_PAGEUP CTRL_PAGEUP
Moves to the first non-white space character on the first line
of the current edit buffer.
:KEY.CTRL_PAGEDOWN CTRL_PAGEDOWN
Moves to the last character on the last line
of the current edit buffer.
:KEY.DOWN <n>DOWN
Move the cursor down one line.
:ITALICS.<n>
is specified, the cursor moves down
:ITALICS.<n>
lines.
:KEY.END END
Moves the cursor to the last character on the current line.
:KEY.ENTER <n>ENTER
Moves the cursor to the start of the next line. If a repeat count
:ITALICS.<n>
is specified, then the cursor is moved down
:ITALICS.<n>
lines.
:KEY.HOME HOME
Moves the cursor the first character of the current line.
:KEY.LEFT <n>LEFT
Move the cursor left one character. If
:ITALICS.<n>
is specified, the cursor moves left
:ITALICS.<n>
characters.
:KEY.PAGEDOWN <n>PAGEDOWN
Moves forwards one page. If a repeat count
:ITALICS.<n>
is specified, then you are moved ahead
:ITALICS.<n>
pages.
The number of lines of context maintained
is controlled by the
:KEYWORD.pagelinesexposed
setting.
:KEY.PAGEUP <n>PAGEUP
Moves backwards one page. If a repeat count
:ITALICS.<n>
is specified, then you are moved back
:ITALICS.<n>
pages.
The number of lines of context maintained
is controlled by the
:KEYWORD.pagelinesexposed
setting.
:KEY.RIGHT <n>RIGHT
Move the cursor right one character. If
:ITALICS.<n>
is specified, the cursor moves right
:ITALICS.<n>
characters.
:KEY.SHIFT_TAB <n>SHIFT_TAB
Moves the cursor left by
:KEYWORD.tabamount
characters. A repeat count
:ITALICS.<n>
multiplies this.
:KEY.TAB <n>TAB
Moves the cursor right by
:KEYWORD.tabamount
characters. A repeat count
:ITALICS.<n>
multiplies this.
:KEY.UP <n>UP
Move the cursor up one line.
:ITALICS.<n>
is specified, the cursor moves up
:ITALICS.<n>
lines.
:KEY.CTRL_B <n>CTRL_B
Moves backwards one page. If a repeat count
:ITALICS.<n>
is specified, then you are moved back
:ITALICS.<n>
pages.
The number of lines of context maintained
is controlled by the
:KEYWORD.pagelinesexposed
setting.
:KEY.CTRL_D <n>CTRL_D
Move down a certain number of lines. The default is to move down
half a page. If the repeat count
:ITALICS.<n>
is specified, then that becomes the number of lines moved from then on.
Also see the
:HILITE.CTRL_U
key.
:KEY.CTRL_E <n>CTRL_E
Expose the line below the last line in the current edit window,
leaving the cursor on the same line if possible. If a repeat
count
:ITALICS.<n>
is specified, then that many lines are exposed.
:KEY.CTRL_F <n>CTRL_F
Moves forwards one page. If a repeat count
:ITALICS.<n>
is specified, then you are moved ahead
:ITALICS.<n>
pages.
The number of lines of context maintained
is controlled by the
:KEYWORD.pagelinesexposed
setting.
:KEY.CTRL_N <n>CTRL_N
Move the cursor to the next line. If a repeat count
:ITALICS.<n>
is specified, then you are moved down
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?