Annotation of src/usr.bin/mg/mg.1, Revision 1.4
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.4 ! deraadt 20: Normal editing commands are very similar to Gnu Emacs. In the
! 21: following examples, ^X means control-X, and M-X means Meta-X,
! 22: where the Meta key may be either a special key on your keyboard
! 23: or the ALT key; otherwise ESC followed by the key X works as well.
! 24: .Pp
! 25: .Bl -tag -width xxxxx -compact
! 26: .It ^f
! 27: Forward character
! 28: .It ^b
! 29: Backwards character
! 30: .It ^n
! 31: Next line
! 32: .It ^p
! 33: Previous line
! 34: .It ^a
! 35: Start of line
! 36: .It ^e
! 37: End of line
! 38: .It ^d
! 39: delete current character
! 40: .It ^s
! 41: interactive search forward
! 42: .It ^r
! 43: interactive search backwards
! 44: .It ^o
! 45: Open a new line at cursor position
! 46: .It ^t
! 47: transpose characters
! 48: .It ^u
! 49: Repeat next command 4 times (can be cascaded, ie. ^u^u^f will move 16 characters forward)
! 50: .Pp
! 51: .It ^k
! 52: kill to end of line (placing into kill buffer)
! 53: .It ^y
! 54: yank kill buffer into current location
! 55: .It ^@
! 56: set mark
! 57: .It ^w
! 58: kill region (cuts from previously set mark to current location, into kill buffer)
! 59: .It M-w
! 60: copy region (into kill buffer)
! 61: .Pp
! 62: .It ^v
! 63: Next page
! 64: .It M-v
! 65: Previous page
! 66: .It M-<
! 67: start of buffer
! 68: .It M->
! 69: end of buffer
! 70: .Pp
! 71: .It ^x^c
! 72: Quit (you will be asked if you want to save files)
! 73: .El
! 74: .Pp
! 75: For more key bindings, type
! 76: .Dq M-x describe-bindings .
! 77: .Pp
! 78: .Nm
! 79: differs primarily in not having special modes for tasks other than
! 80: straight editing, e.g., mail and news, and in not having special modes that
1.1 deraadt 81: support various programming languages. It does have text justification
1.4 ! deraadt 82: and auto-fill mode. Since it is written completely in C, there is no
1.3 aaron 83: language in which you can write extensions. However, you can rebind
1.1 deraadt 84: keys and change some parameters. There are no limits to line length
85: or format. Command, buffer, and file name completion and listing can
1.3 aaron 86: be done using the spacebar and
87: .Ql ? ,
88: respectively.
1.2 deraadt 89: .Pp
1.4 ! deraadt 90: Amonst other major differences, the
1.2 deraadt 91: .Nm
1.4 ! deraadt 92: configuration files are much simpler than real emacs.
1.1 deraadt 93: There are two configuration files,
1.3 aaron 94: .Pa .mg ,
1.1 deraadt 95: and
1.3 aaron 96: .Pa .mg-TERM .
97: Here,
98: .Ev TERM
99: represents the name of you terminal type; e.g., if your terminal type
100: is set to
101: .Dq vt100 ,
1.2 deraadt 102: .Nm
1.1 deraadt 103: will use
1.3 aaron 104: .Pa .mg-vt100
1.1 deraadt 105: as a startup file. The terminal type startup file is used
106: first. If either of these files does not exist,
1.2 deraadt 107: .Nm
1.1 deraadt 108: will look for a file by the same name (but without the leading
109: dot) in
1.3 aaron 110: .Pa /usr/local/lib/mg .
1.2 deraadt 111: .Pp
1.1 deraadt 112: See the manual for a full list of the commands that can
1.4 ! deraadt 113: go in the files.
1.2 deraadt 114: .Pp
1.3 aaron 115: Here's another example sequence that you may find useful. By default,
116: .Dq ()
117: and
118: .Dq []
119: are recognized as brackets, so bracket matching can be done.
120: The following defines
121: .Dq {}
122: as brackets, and turns on the mode that causes
1.1 deraadt 123: the cursor to "blink" to show you matching brackets.
1.2 deraadt 124: .Bd -literal -offset indent
125: global-set-key } blink-matching-paren-hack
126: blink-matching-paren
127: set-default-mode blink
128: .Ed
1.3 aaron 129: .Sh FILES
130: .Bl -tag -width /usr/local/lib/mg -compact
131: .It Pa ~/.mg
132: normal startup file
133: .It Pa ~/.mg-TERM
134: terminal-specific startup file
135: .It Pa /usr/local/lib/mg
136: directory for system-wide startup files
137: .El
138: .Sh SEE ALSO
1.2 deraadt 139: .Xr vi 1
140: .Sh BUGS
1.3 aaron 141: When you type
142: .Ql ?
143: to list possible file names, buffer names, etc.,
1.1 deraadt 144: a help buffer is created for the possibilities. In Gnu Emacs,
145: this buffer goes away the next time you type a real command.
146: In
1.3 aaron 147: .Nm mg ,
1.4 ! deraadt 148: you must use "M-x 1" to get rid of it.