Annotation of src/usr.bin/mg/mg.1, Revision 1.2
1.2 ! deraadt 1: .Dd February 25, 2000
! 2: .Dt MG 1
! 3: .Os
! 4: .Sh NAME
! 5: .Nm mg
! 6: .Nd emacs-like text editor
! 7: .Sh SYNOPSIS
! 8: .Nm mg
! 9: .Op files
! 10: .Sh DESCRIPTION
! 11: .Nm
! 12: is intented intended to be a small, fast, and portable editor for
! 13: people who can't (or don't want to) run real emacs thing for one
! 14: reason or another, or are not familiar with the
! 15: .Xr vi 1
! 16: editor. It is compatible with emacs because there shouldn't
! 17: be any reason to learn more editor types than emacs or
! 18: .Xr vi 1 .
! 19: .Pp
1.1 deraadt 20: Normal editing commands should be identical to Gnu Emacs. It differs
21: primarily in not having special modes for tasks other than straight
22: editing, e.g. mail and news, and in not having special modes that
23: support various programming languages. It does have text justification
24: and auto-fill mode. It is written directly in C, so there is no
25: language in which you can write extensions. However you can rebind
26: keys and change some parameters. There are no limits to line length
27: or format. Command, buffer, and file name completion and listing can
28: be done using space and ? respectively.
1.2 ! deraadt 29: .Pp
! 30: .Pp
1.1 deraadt 31: The one major difference is in configuration files. Gnu Emacs uses
32: a configuration file
33: .IR .emacs ,
34: which is written in Lisp.
1.2 ! deraadt 35: .Nm
1.1 deraadt 36: uses its own configuration files, which contain extend mode Emacs
37: commands (i.e. commands that you could type after doing m-x).
38: There are two configuration files,
39: .IR .mg ,
40: and
41: .IR .mg-TERM .
42: TERM here represents the name of you terminal type. E.g. if
43: your terminal type is set to vt100,
1.2 ! deraadt 44: .Nm
1.1 deraadt 45: will use
46: .I .mg-vt100
47: as a startup file. The terminal type startup file is used
48: first. If either of these files does not exist,
1.2 ! deraadt 49: .Nm
1.1 deraadt 50: will look for a file by the same name (but without the leading
51: dot) in
52: .IR /usr/local/lib/mg .
1.2 ! deraadt 53: .Pp
1.1 deraadt 54: See the manual for a full list of the commands that can
55: go in the files. The most commonly
56: used ones are probably key binding. The following example is
57: part of a configuration file used to set make
1.2 ! deraadt 58: .Nm
1.1 deraadt 59: respond to the keypad on a Microport SV/AT system. The normal
60: keys send a sequence of the form <ESC> [ <letter>. I also
61: want to use keys prefixed by <ESC> as having different meaning.
62: In order to deal with multi-character sequences, the initial
63: subsequences must be defined as prefixes. To allow for this,
64: three prefixes are left undefined in the initial setup. They
65: are called "extra prefix 1", etc.
1.2 ! deraadt 66: .Bd -literal -offset indent
! 67: ;allow normal pad
! 68: global-set-key ^[[ "extra prefix 1"
! 69: ;allow prefixed pad
! 70: global-set-key ^[^[ "extra prefix 2"
! 71: global-set-key ^[^[[ "extra prefix 3"
! 72: ;keypad
! 73: global-set-key ^[[A previous-line
! 74: global-set-key ^[[H scroll-down
! 75: ...etc
! 76:
! 77: ;escaped keypad
! 78: global-set-key ^[^[[A exchange-point-and-mark
! 79: global-set-key ^[^[[H beginning-of-buffer
! 80: .Ed
! 81: .Pp
1.1 deraadt 82: Here's another example sequence that you may find useful. By default ()
83: and [] are recognized as brackets, so bracket matching can be done.
84: The following defines {} as brackets, and turns on the mode that causes
85: the cursor to "blink" to show you matching brackets.
1.2 ! deraadt 86: .Bd -literal -offset indent
! 87: global-set-key } blink-matching-paren-hack
! 88: blink-matching-paren
! 89: set-default-mode blink
! 90: .Ed
! 91: .Pp
! 92: .Sh ARGUMENTS
! 93: .Nm
1.1 deraadt 94: does not take any options. The only arguments you can pass it are
95: file names. It will do a find-file on each one, reading it into
1.2 ! deraadt 96: a buffer. It will leave the last buffer on the screen.
! 97: .Sh "SEE ALSO"
! 98: .Xr vi 1
! 99: .Sh BUGS
1.1 deraadt 100: When you type ? to list possible file names, buffer names, etc.,
101: a help buffer is created for the possibilities. In Gnu Emacs,
102: this buffer goes away the next time you type a real command.
103: In
1.2 ! deraadt 104: .Nm ,
1.1 deraadt 105: you must use "m-x 1" to get rid of it.
1.2 ! deraadt 106: .Sh FILES
! 107: .Pp
! 108: .Bl -tag -width /etc/passwd -compact
! 109: .It ~/.mg
! 110: normal startup file
! 111: .It ~/.mg-TERM
! 112: terminal-specific startup file
! 113: .It /usr/local/lib/mg
! 114: Directory for system-wide startup files. (Files in
! 115: this directory do not have the leading dot).
! 116: .El