Annotation of src/usr.bin/mg/mg.1, Revision 1.12
1.12 ! deraadt 1: .\" $OpenBSD: mg.1,v 1.11 2002/02/08 00:51:55 deraadt Exp $
1.9 niklas 2: .\"
1.2 deraadt 3: .Dd February 25, 2000
4: .Dt MG 1
5: .Os
6: .Sh NAME
7: .Nm mg
8: .Nd emacs-like text editor
9: .Sh SYNOPSIS
10: .Nm mg
1.3 aaron 11: .Op Ar
1.2 deraadt 12: .Sh DESCRIPTION
13: .Nm
1.3 aaron 14: is intended to be a small, fast, and portable editor for
15: people who can't (or don't want to) run the real emacs for one
1.2 deraadt 16: reason or another, or are not familiar with the
17: .Xr vi 1
1.6 aaron 18: editor.
19: It is compatible with emacs because there shouldn't
1.2 deraadt 20: be any reason to learn more editor types than emacs or
21: .Xr vi 1 .
22: .Pp
1.6 aaron 23: Normal editing commands are very similar to Gnu Emacs.
24: In the following examples, ^X means control-X, and M-X means Meta-X,
1.4 deraadt 25: where the Meta key may be either a special key on your keyboard
26: or the ALT key; otherwise ESC followed by the key X works as well.
27: .Pp
28: .Bl -tag -width xxxxx -compact
1.11 deraadt 29: .It ^F
1.4 deraadt 30: Forward character
1.11 deraadt 31: .It ^B
1.4 deraadt 32: Backwards character
1.11 deraadt 33: .It ^N
1.4 deraadt 34: Next line
1.11 deraadt 35: .It ^P
1.4 deraadt 36: Previous line
1.11 deraadt 37: .It ^A
1.4 deraadt 38: Start of line
1.11 deraadt 39: .It ^E
1.4 deraadt 40: End of line
1.11 deraadt 41: .It ^D
1.4 deraadt 42: delete current character
1.11 deraadt 43: .It ^S
1.4 deraadt 44: interactive search forward
1.11 deraadt 45: .It ^R
1.4 deraadt 46: interactive search backwards
1.11 deraadt 47: .It ^O
1.4 deraadt 48: Open a new line at cursor position
1.11 deraadt 49: .It ^T
1.4 deraadt 50: transpose characters
1.11 deraadt 51: .It ^U
1.4 deraadt 52: Repeat next command 4 times (can be cascaded, ie. ^u^u^f will move 16 characters forward)
53: .Pp
1.11 deraadt 54: .It ^K
1.4 deraadt 55: kill to end of line (placing into kill buffer)
1.11 deraadt 56: .It ^Y
1.4 deraadt 57: yank kill buffer into current location
58: .It ^@
59: set mark
1.11 deraadt 60: .It ^W
1.4 deraadt 61: kill region (cuts from previously set mark to current location, into kill buffer)
1.11 deraadt 62: .It M-W
1.4 deraadt 63: copy region (into kill buffer)
64: .Pp
1.11 deraadt 65: .It ^V
1.4 deraadt 66: Next page
1.11 deraadt 67: .It M-V
1.4 deraadt 68: Previous page
69: .It M-<
70: start of buffer
71: .It M->
72: end of buffer
73: .Pp
1.11 deraadt 74: .It ^X^C
1.4 deraadt 75: Quit (you will be asked if you want to save files)
1.11 deraadt 76: .It ^X-O
77: Next window.
78: .It ^X-N
79: Next window.
80: .It ^X-P
81: Previous window.
1.12 ! deraadt 82: .It ^X-U
! 83: Undo.
1.4 deraadt 84: .El
85: .Pp
86: For more key bindings, type
87: .Dq M-x describe-bindings .
88: .Pp
89: .Nm
90: differs primarily in not having special modes for tasks other than
91: straight editing, e.g., mail and news, and in not having special modes that
1.6 aaron 92: support various programming languages.
93: It does have text justification
94: and auto-fill mode.
95: Since it is written completely in C, there is no
96: language in which you can write extensions.
97: However, you can rebind keys and change some parameters.
98: There are no limits to line length or format.
99: Command, buffer, and file name completion and listing can
1.3 aaron 100: be done using the spacebar and
101: .Ql ? ,
102: respectively.
1.2 deraadt 103: .Pp
1.10 bjc 104: Amongst other major differences, the
1.2 deraadt 105: .Nm
1.4 deraadt 106: configuration files are much simpler than real emacs.
1.7 aaron 107: There are two configuration files,
1.3 aaron 108: .Pa .mg ,
1.1 deraadt 109: and
1.3 aaron 110: .Pa .mg-TERM .
111: Here,
112: .Ev TERM
113: represents the name of you terminal type; e.g., if your terminal type
114: is set to
115: .Dq vt100 ,
1.2 deraadt 116: .Nm
1.1 deraadt 117: will use
1.3 aaron 118: .Pa .mg-vt100
1.6 aaron 119: as a startup file.
120: The terminal type startup file is used first.
1.1 deraadt 121: See the manual for a full list of the commands that can
1.4 deraadt 122: go in the files.
1.2 deraadt 123: .Pp
1.6 aaron 124: Here's another example sequence that you may find useful.
125: By default,
1.3 aaron 126: .Dq ()
127: and
128: .Dq []
129: are recognized as brackets, so bracket matching can be done.
130: The following defines
131: .Dq {}
132: as brackets, and turns on the mode that causes
1.1 deraadt 133: the cursor to "blink" to show you matching brackets.
1.2 deraadt 134: .Bd -literal -offset indent
135: global-set-key } blink-matching-paren-hack
136: blink-matching-paren
137: set-default-mode blink
1.11 deraadt 138: .Ed
139: .Pp
140: More complicated key mappings are also possible, though there are are some
141: internal limitations compared to regular emacs. An example of how to map
142: control characters and sequences follows, illustrating the Gosling-like
143: line scrolling characters.
144: .Bd -literal -offset indent
145: global-set-key "\\^Z" scroll-one-line-up
146: global-set-key "\\ez" scroll-one-line-down
147: global-set-key "\\^_" suspend-emacs
1.2 deraadt 148: .Ed
1.3 aaron 149: .Sh FILES
1.8 aaron 150: .Bl -tag -width ~/.mg-TERM -compact
1.3 aaron 151: .It Pa ~/.mg
152: normal startup file
153: .It Pa ~/.mg-TERM
154: terminal-specific startup file
155: .El
156: .Sh SEE ALSO
1.2 deraadt 157: .Xr vi 1
158: .Sh BUGS
1.3 aaron 159: When you type
160: .Ql ?
161: to list possible file names, buffer names, etc.,
1.6 aaron 162: a help buffer is created for the possibilities.
163: In Gnu Emacs,
1.1 deraadt 164: this buffer goes away the next time you type a real command.
165: In
1.3 aaron 166: .Nm mg ,
1.4 deraadt 167: you must use "M-x 1" to get rid of it.