Annotation of src/usr.bin/mg/mg.1, Revision 1.11
1.11 ! deraadt 1: .\" $OpenBSD: mg.1,v 1.10 2001/04/11 10:48:40 bjc 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.4 deraadt 82: .El
83: .Pp
84: For more key bindings, type
85: .Dq M-x describe-bindings .
86: .Pp
87: .Nm
88: differs primarily in not having special modes for tasks other than
89: straight editing, e.g., mail and news, and in not having special modes that
1.6 aaron 90: support various programming languages.
91: It does have text justification
92: and auto-fill mode.
93: Since it is written completely in C, there is no
94: language in which you can write extensions.
95: However, you can rebind keys and change some parameters.
96: There are no limits to line length or format.
97: Command, buffer, and file name completion and listing can
1.3 aaron 98: be done using the spacebar and
99: .Ql ? ,
100: respectively.
1.2 deraadt 101: .Pp
1.10 bjc 102: Amongst other major differences, the
1.2 deraadt 103: .Nm
1.4 deraadt 104: configuration files are much simpler than real emacs.
1.7 aaron 105: There are two configuration files,
1.3 aaron 106: .Pa .mg ,
1.1 deraadt 107: and
1.3 aaron 108: .Pa .mg-TERM .
109: Here,
110: .Ev TERM
111: represents the name of you terminal type; e.g., if your terminal type
112: is set to
113: .Dq vt100 ,
1.2 deraadt 114: .Nm
1.1 deraadt 115: will use
1.3 aaron 116: .Pa .mg-vt100
1.6 aaron 117: as a startup file.
118: The terminal type startup file is used first.
1.1 deraadt 119: See the manual for a full list of the commands that can
1.4 deraadt 120: go in the files.
1.2 deraadt 121: .Pp
1.6 aaron 122: Here's another example sequence that you may find useful.
123: By default,
1.3 aaron 124: .Dq ()
125: and
126: .Dq []
127: are recognized as brackets, so bracket matching can be done.
128: The following defines
129: .Dq {}
130: as brackets, and turns on the mode that causes
1.1 deraadt 131: the cursor to "blink" to show you matching brackets.
1.2 deraadt 132: .Bd -literal -offset indent
133: global-set-key } blink-matching-paren-hack
134: blink-matching-paren
135: set-default-mode blink
1.11 ! deraadt 136: .Ed
! 137: .Pp
! 138: More complicated key mappings are also possible, though there are are some
! 139: internal limitations compared to regular emacs. An example of how to map
! 140: control characters and sequences follows, illustrating the Gosling-like
! 141: line scrolling characters.
! 142: .Bd -literal -offset indent
! 143: global-set-key "\\^Z" scroll-one-line-up
! 144: global-set-key "\\ez" scroll-one-line-down
! 145: global-set-key "\\^_" suspend-emacs
1.2 deraadt 146: .Ed
1.3 aaron 147: .Sh FILES
1.8 aaron 148: .Bl -tag -width ~/.mg-TERM -compact
1.3 aaron 149: .It Pa ~/.mg
150: normal startup file
151: .It Pa ~/.mg-TERM
152: terminal-specific startup file
153: .El
154: .Sh SEE ALSO
1.2 deraadt 155: .Xr vi 1
156: .Sh BUGS
1.3 aaron 157: When you type
158: .Ql ?
159: to list possible file names, buffer names, etc.,
1.6 aaron 160: a help buffer is created for the possibilities.
161: In Gnu Emacs,
1.1 deraadt 162: this buffer goes away the next time you type a real command.
163: In
1.3 aaron 164: .Nm mg ,
1.4 deraadt 165: you must use "M-x 1" to get rid of it.