[BACK]Return to mg.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

File: [local] / src / usr.bin / mg / mg.1 (download)

Revision 1.3, Mon Feb 28 14:59:54 2000 UTC (24 years, 3 months ago) by aaron
Branch: MAIN
Changes since 1.2: +41 -38 lines

Lots of obvious clean-up, but needs more work.

.Dd February 25, 2000
.Dt MG 1
.Os
.Sh NAME
.Nm mg
.Nd emacs-like text editor
.Sh SYNOPSIS
.Nm mg
.Op Ar
.Sh DESCRIPTION
.Nm
is intended to be a small, fast, and portable editor for
people who can't (or don't want to) run the real emacs for one
reason or another, or are not familiar with the
.Xr vi 1
editor.  It is compatible with emacs because there shouldn't
be any reason to learn more editor types than emacs or
.Xr vi 1 .
.Pp
Normal editing commands should be identical to Gnu Emacs.  It differs
primarily in not having special modes for tasks other than straight
editing, e.g., mail and news, and in not having special modes that
support various programming languages.  It does have text justification
and auto-fill mode.  It is written directly in C, so there is no
language in which you can write extensions.  However, you can rebind
keys and change some parameters.  There are no limits to line length
or format.  Command, buffer, and file name completion and listing can
be done using the spacebar and
.Ql ? ,
respectively.
.Pp
The one major difference is in configuration files.  Gnu Emacs uses
a configuration file 
.Pa .emacs ,
which is written in Lisp.
.Nm
uses its own configuration files, which contain extend mode Emacs
commands (i.e., commands that you could type after doing m-x).
There are two configuration files, 
.Pa .mg ,
and
.Pa .mg-TERM .
Here,
.Ev TERM
represents the name of you terminal type; e.g., if your terminal type
is set to
.Dq vt100 ,
.Nm
will use
.Pa .mg-vt100
as a startup file.  The terminal type startup file is used
first.  If either of these files does not exist, 
.Nm
will look for a file by the same name (but without the leading
dot) in
.Pa /usr/local/lib/mg .
.Pp
See the manual for a full list of the commands that can
go in the files. The most commonly  
used ones are probably key binding.  The following example is
part of a configuration file used to set make
.Nm
respond to the keypad on a Microport SV/AT system.  The normal
keys send a sequence of the form <ESC> [ <letter>.  I also
want to use keys prefixed by <ESC> as having different meaning.
In order to deal with multi-character sequences, the initial
subsequences must be defined as prefixes.  To allow for this,
three prefixes are left undefined in the initial setup.  They
are called "extra prefix 1", etc.
.Bd -literal -offset indent
;allow normal pad
global-set-key ^[[ "extra prefix 1"
;allow prefixed pad
global-set-key ^[^[ "extra prefix 2"
global-set-key ^[^[[ "extra prefix 3"
;keypad
global-set-key ^[[A previous-line
global-set-key ^[[H scroll-down
...etc

;escaped keypad
global-set-key ^[^[[A exchange-point-and-mark
global-set-key ^[^[[H beginning-of-buffer
.Ed
.Pp
Here's another example sequence that you may find useful.  By default,
.Dq ()
and
.Dq []
are recognized as brackets, so bracket matching can be done.
The following defines
.Dq {}
as brackets, and turns on the mode that causes
the cursor to "blink" to show you matching brackets.
.Bd -literal -offset indent
global-set-key } blink-matching-paren-hack
blink-matching-paren
set-default-mode blink
.Ed
.Sh FILES
.Bl -tag -width /usr/local/lib/mg -compact
.It Pa ~/.mg
normal startup file
.It Pa ~/.mg-TERM
terminal-specific startup file
.It Pa /usr/local/lib/mg
directory for system-wide startup files
.El
.Sh SEE ALSO
.Xr vi 1
.Sh BUGS
When you type
.Ql ?
to list possible file names, buffer names, etc.,
a help buffer is created for the possibilities.  In Gnu Emacs,
this buffer goes away the next time you type a real command.
In
.Nm mg ,
you must use "m-x 1" to get rid of it.