Annotation of src/usr.bin/mg/mg.1, Revision 1.3
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
1.3 ! aaron 9: .Op Ar
1.2 deraadt 10: .Sh DESCRIPTION
11: .Nm
1.3 ! aaron 12: is intended to be a small, fast, and portable editor for
! 13: people who can't (or don't want to) run the real emacs for one
1.2 deraadt 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
1.3 ! aaron 22: editing, e.g., mail and news, and in not having special modes that
1.1 deraadt 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
1.3 ! aaron 25: language in which you can write extensions. However, you can rebind
1.1 deraadt 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
1.3 ! aaron 28: be done using the spacebar and
! 29: .Ql ? ,
! 30: respectively.
1.2 deraadt 31: .Pp
1.1 deraadt 32: The one major difference is in configuration files. Gnu Emacs uses
33: a configuration file
1.3 ! aaron 34: .Pa .emacs ,
1.1 deraadt 35: which is written in Lisp.
1.2 deraadt 36: .Nm
1.1 deraadt 37: uses its own configuration files, which contain extend mode Emacs
1.3 ! aaron 38: commands (i.e., commands that you could type after doing m-x).
1.1 deraadt 39: There are two configuration files,
1.3 ! aaron 40: .Pa .mg ,
1.1 deraadt 41: and
1.3 ! aaron 42: .Pa .mg-TERM .
! 43: Here,
! 44: .Ev TERM
! 45: represents the name of you terminal type; e.g., if your terminal type
! 46: is set to
! 47: .Dq vt100 ,
1.2 deraadt 48: .Nm
1.1 deraadt 49: will use
1.3 ! aaron 50: .Pa .mg-vt100
1.1 deraadt 51: as a startup file. The terminal type startup file is used
52: first. If either of these files does not exist,
1.2 deraadt 53: .Nm
1.1 deraadt 54: will look for a file by the same name (but without the leading
55: dot) in
1.3 ! aaron 56: .Pa /usr/local/lib/mg .
1.2 deraadt 57: .Pp
1.1 deraadt 58: See the manual for a full list of the commands that can
59: go in the files. The most commonly
60: used ones are probably key binding. The following example is
61: part of a configuration file used to set make
1.2 deraadt 62: .Nm
1.1 deraadt 63: respond to the keypad on a Microport SV/AT system. The normal
64: keys send a sequence of the form <ESC> [ <letter>. I also
65: want to use keys prefixed by <ESC> as having different meaning.
66: In order to deal with multi-character sequences, the initial
67: subsequences must be defined as prefixes. To allow for this,
68: three prefixes are left undefined in the initial setup. They
69: are called "extra prefix 1", etc.
1.2 deraadt 70: .Bd -literal -offset indent
71: ;allow normal pad
72: global-set-key ^[[ "extra prefix 1"
73: ;allow prefixed pad
74: global-set-key ^[^[ "extra prefix 2"
75: global-set-key ^[^[[ "extra prefix 3"
76: ;keypad
77: global-set-key ^[[A previous-line
78: global-set-key ^[[H scroll-down
79: ...etc
80:
81: ;escaped keypad
82: global-set-key ^[^[[A exchange-point-and-mark
83: global-set-key ^[^[[H beginning-of-buffer
84: .Ed
85: .Pp
1.3 ! aaron 86: Here's another example sequence that you may find useful. By default,
! 87: .Dq ()
! 88: and
! 89: .Dq []
! 90: are recognized as brackets, so bracket matching can be done.
! 91: The following defines
! 92: .Dq {}
! 93: as brackets, and turns on the mode that causes
1.1 deraadt 94: the cursor to "blink" to show you matching brackets.
1.2 deraadt 95: .Bd -literal -offset indent
96: global-set-key } blink-matching-paren-hack
97: blink-matching-paren
98: set-default-mode blink
99: .Ed
1.3 ! aaron 100: .Sh FILES
! 101: .Bl -tag -width /usr/local/lib/mg -compact
! 102: .It Pa ~/.mg
! 103: normal startup file
! 104: .It Pa ~/.mg-TERM
! 105: terminal-specific startup file
! 106: .It Pa /usr/local/lib/mg
! 107: directory for system-wide startup files
! 108: .El
! 109: .Sh SEE ALSO
1.2 deraadt 110: .Xr vi 1
111: .Sh BUGS
1.3 ! aaron 112: When you type
! 113: .Ql ?
! 114: to list possible file names, buffer names, etc.,
1.1 deraadt 115: a help buffer is created for the possibilities. In Gnu Emacs,
116: this buffer goes away the next time you type a real command.
117: In
1.3 ! aaron 118: .Nm mg ,
1.1 deraadt 119: you must use "m-x 1" to get rid of it.