📄 basic.gml
字号:
.****************************************************************************
.*
.* Open Watcom Project
.*
.* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
.*
.* ========================================================================
.*
.* This file contains Original Code and/or Modifications of Original
.* Code as defined in and that are subject to the Sybase Open Watcom
.* Public License version 1.0 (the 'License'). You may not use this file
.* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
.* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
.* provided with the Original Code and Modifications, and is also
.* available at www.sybase.com/developer/opensource.
.*
.* The Original Code and all software distributed under the License are
.* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
.* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
.* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
.* NON-INFRINGEMENT. Please see the License for the specific language
.* governing rights and limitations under the License.
.*
.* ========================================================================
.*
.* Description: Basic usage.
.*
.* Date By Reason
.* ---- -- ------
.* 10-aug-92 Craig Eisler initial draft
.* 28-sep-05 L. Haynes reformatted, figures, gadget menu invocation
.* 30-apr-06 F. Beythien some minor corrections
.*
.****************************************************************************/
.chap *refid=basic 'Basic Usage'
.np
Using any editor as powerful as &edvi. takes some practice. This chapter
will lead you through the basics or using &edvi.
.* ******************************************************************
.section 'Starting the &edname.'
.* ******************************************************************
.np
&edvi is invoked by typing the command
.millust begin
vi
.millust end
at the command prompt. Try typing this. You will see something similar
to the following:
.figure *depth='2.47' *scale='59' *file='vi001' The &edvi screen
.np
If you are running DOS on a 386 (or higher)
machine, then you can also use the
.keyword protected mode
version of &edvi.. This version of &edvi 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
.millust begin
vip
.millust end
at the command prompt.
.np
&edvi also accepts one or more files as an optional parameter. Each
file that you specify will be edited by &edvi.. For example, typing
.millust begin
vi test.c
.millust end
will edit the file
.mono test.c
:period.
Typing
.millust begin
vi test.c other.c
.millust end
will edit the files
.mono test.c
and
.mono other.c
:period.
Typing
.millust begin
vi *.c
.millust end
will edit all files that have the extension
.mono .c
:period.
.np
:INCLUDE file='exitvi'.
.* ******************************************************************
.section 'What is a Modal Editor?'
.* ******************************************************************
.np
A modal editor is one where keystrokes have different meaning, depending
on what mode you are in. &edvi has two main modes, &cmdmode and
&tinsmode.
:period.
.np
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).
.np
It is easy to tell what mode you are in while using &edvi..
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.
.np
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:
.millust begin
Mode: command
.millust end
While in &tinsmode, you will see either:
.millust begin
Mode: insert
.millust end
or
.millust begin
Mode: overstrike
.millust end
depending on whether you are inserting or overstriking text.
.np
&edvi is in &cmdmode by default. There are numerous ways to enter
&tinsmode, the easiest of which is to press the
.param Insert
key on your keyboard.
.np
The
.param ESC
key is one of the more important keys in &edvi.. Pressing
.param ESC
once will stop whatever you are doing and
return you to &cmdmode.
:period.
If you have started a &cmdmode sequence, pressing
.param ESC
will cancel the command and return you to &cmdmode.
:period.
.exercises
Start up &edvi by typing
.millust begin
vi
.millust end
at your command prompt.
.np
You will see a screen that looks like the following:
.figure *depth='2.47' *scale='59' *file='vi001' The &edvi screen
.np
Press the insert (
.param INS
) key. The cursor will get larger and you will see the mode indicator change
from
.millust begin
Mode: command
.millust end
to
.millust begin
Mode: insert
.millust end
Try typing some characters. Notice that they appear in the edit window
as you type. When you are done, press the
.param ESC
key. The cursor will get smaller and you will see the mode indicator
change from
.millust begin
Mode: insert
.millust end
to
.millust begin
Mode: command
.millust end
.np
:INCLUDE file='exitvi'.
.np
Once you exit, you will be prompted with a message as follows:
.figure *depth='2.47' *scale='59' *file='vi003' The Really Exit prompt
there are still files that have been modified but not saved.
Press 'n' then the
.param ENTER
key to exit without saving your current file.
.* ******************************************************************
.section 'Some Basic Commands'
.* ******************************************************************
.np
To begin editing with &edvi, 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.
.*
.beglevel
.* ******************************************************************
.section 'Moving Around'
.* ******************************************************************
.np
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'
.np
These same cursor keys may also be used when entering text in &tinsmode.
:period.
.* ******************************************************************
.section *refid=savexit 'Saving and Exiting a File'
.* ******************************************************************
.np
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.
.np
You can discard ALL of your files by
selecting the
.keyword Exit
item in the
.keyword File
menu. Alternatively, you can discard or save the changes on
an individual file basis.
.np
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
.param 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 &edvi will exit.
.np
You may use certain menu items to save or discard changes to your file.
The main menu option
.keyword File
(by clicking on it with the mouse or by pressing
.param 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
.param ALT_G
:period.
You can also access this menu by clicking on the gadget ('
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -