basic.gml
来自「开放源码的编译器open watcom 1.6.0版的源代码」· GML 代码 · 共 212 行
GML
212 行
.*
.* (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
.* ---- -- ------
.* 10-aug-92 Craig Eisler initial draft
.*
:CHAPTER id='basic'.Basic Usage
:SECTION.Invoking &edname
&edname is invoked by typing the command
:ILLUST.
vi
:eILLUST.
at the command prompt. Try typing this. You will see something similar
to the following:
:PICTURE file='vistart' text='&edname Display'.
:P.
If you are running DOS on a 386 (or higher)
machine, then you can also use the
:ITALICS.protected mode
version of &edname.. This version of &edname runs as a native 386
application, which means that it has access to more memory and will do its
processing more quickly. You can start this version by typing
:ILLUST.
vip
:eILLUST.
at the command prompt.
:P.
&edname also accepts one or more files as an optional parameter. Each
file that you specify will be edited by &edname.. For example, typing
:ILLUST.
vi test.c
:eILLUST.
will edit the file
:ITALICS.test.c
:PERIOD.
Typing
:ILLUST.
vi test.c other.c
:eILLUST.
will edit the files
:ITALICS.test.c
and
:ITALICS.other.c
:PERIOD.
Typing
:ILLUST.
vi *.c
:eILLUST.
will edit all files that have the extension
:ITALICS..c
:PERIOD.
:P.
:INCLUDE file='exitvi'.
:SECTION.What is a Modal Editor?
A modal editor is one where keystrokes have different meaning, depending
on what mode you are in. &edname has two main modes, &cmdmode and
&tinsmode.
:PERIOD.
:P.
While in &cmdmode, pressing a key on your keyboard can cause something
different to happen. For example, pressing the letter D (capital 'd')
deletes all characters from the current cursor position to the end of the
line.
If the same letter 'D' (is pressed while in &tinsmode,
the letter 'D' appears in your text (much as you would expect).
:P.
It is easy to tell what mode you are in while using &edname..
When you are in &cmdmode, the cursor is a thin line. When
you are in &tinsmode, the cursor is much thicker: if you are inserting
text, the cursor is one half of a full block, and if you are overstriking
text, the cursor is a full block.
:P.
The mode indicator on the menu bar at the
top of your screen shows the current mode.
While in &cmdmode, you will see the following:
:ILLUST.
Mode: command
:eILLUST.
While in &tinsmode, you will see either:
:ILLUST.
Mode: insert
:eILLUST.
or
:ILLUST.
Mode: overstrike
:eILLUST.
depending on whether you are inserting or overstriking text.
:P.
&edname is in &cmdmode by default. There are numerous ways to enter
&tinsmode, the easiest of which is to press the
:HILITE.Insert
key on your keyboard.
:P.
The
:HILITE.ESC
key is one of the more important keys in &edname.. Pressing
:HILITE.ESC
once will stop whatever you are doing and
return you to &cmdmode.
:PERIOD.
If you have started a &cmdmode sequence, pressing
:HILITE.ESC
will cancel the command and return you to &cmdmode.
:PERIOD.
:EXERCISES.
Start up &edname by typing
:ILLUST.
vi
:eILLUST.
at your command prompt.
:P.
You will see a screen that looks like the following:
:PICTURE file='vistart' text='&edname Display'.
:P.
Press the insert (
:HILITE.INS
) key. The cursor will get larger and you will see the mode indicator change
from
:ILLUST.
Mode: command
:eILLUST.
to
:ILLUST.
Mode: insert
:eILLUST.
Try typing some characters. Notice that they appear in the edit window
as you type. When you are done, press the
:HILITE.ESC
key. The cursor will get smaller and you will see the mode indicator
change from
:ILLUST.
Mode: insert
:eILLUST.
to
:ILLUST.
Mode: command
:eILLUST.
:P.
:INCLUDE file='exitvi'.
:P.
Once you exit, you will be prompted with a message as follows:
:PICTURE file='exit' text='Really Exit Prompt'.
This lets you know that you are attempting to leave &edname while
there are still files that have been modified but not saved.
Press 'n' then the
:HILITE.ENTER
key to exit without saving your current file.
:eEXERCISES.
:SECTION.Some Basic Commands
To begin editing with &edname, there are only a few basic commands
that you need to learn. Once you master these few commands, you
will be able to accomplish all basic editing tasks.
In later chapters, more sophisticated commands will be introduced which
allow advanced tasks to be completed more quickly.
:SUBSECT.Moving Around
When you are in &cmdmode, you may move around in your text using
various cursor keys. The basic keys that you use to move around are:
:INCLUDE file='basicmv'
:P.
These same cursor keys may also be used when entering text in &tinsmode
:PERIOD.
:eSUBSECT.
:SUBSECT id='savexit'.Saving and Exiting a File
Once you have modified a file, may want to save it and either edit other
files or exit the editor. When
you exit a modified file, you may want to either discard your changes or
keep them.
:P.
You can discard ALL of your files by
either pressing
:HILITE.CTRL_C
or selecting the
:HILITE.Exit
item in the
:HILITE.Control
menu. Alternatively, you can discard or save the changes on
an individual file basis.
:P.
If you wish to save the current file you are editing and leave that
particular edit session, the fastest way to do it is to use the
command 'ZZ'. Press
:HILITE.ESC
to make sure that you are in &cmdmode
:CONT., and then type two capital z's ('ZZ')
in a row. This saves the file, then exits the edit buffer for the file.
If you are editing any other files, the next
one in the list will become the current one. If you are not
editing any other files, then &edname will exit.
:P.
You may use certain menu items to save or discard changes to your file.
The main menu option
:HILITE.File
(by clicking on it with the mouse or by pressing
:HILITE.ALT_F
:CONT.)
has options for saving the current file. As well,
each edit window has a menu associated with it that you can access
by pressing
:HILITE.ALT_W
:PERIOD.
You can also access this menu by clicking on the gadget ('
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?