.Dd February 25, 2000 .Dt MG 1 .Os .Sh NAME .Nm mg .Nd emacs-like text editor .Sh SYNOPSIS .Nm mg .Op files .Sh DESCRIPTION .Nm is intented intended to be a small, fast, and portable editor for people who can't (or don't want to) run real emacs thing for one reason or another, or are not familiar with the .Xr vi 1 editor. It is compatible with emacs because there shouldn't be any reason to learn more editor types than emacs or .Xr vi 1 . .Pp Normal editing commands should be identical to Gnu Emacs. It differs primarily in not having special modes for tasks other than straight editing, e.g. mail and news, and in not having special modes that support various programming languages. It does have text justification and auto-fill mode. It is written directly in C, so there is no language in which you can write extensions. However you can rebind keys and change some parameters. There are no limits to line length or format. Command, buffer, and file name completion and listing can be done using space and ? respectively. .Pp .Pp The one major difference is in configuration files. Gnu Emacs uses a configuration file .IR .emacs , which is written in Lisp. .Nm uses its own configuration files, which contain extend mode Emacs commands (i.e. commands that you could type after doing m-x). There are two configuration files, .IR .mg , and .IR .mg-TERM . TERM here represents the name of you terminal type. E.g. if your terminal type is set to vt100, .Nm will use .I .mg-vt100 as a startup file. The terminal type startup file is used first. If either of these files does not exist, .Nm will look for a file by the same name (but without the leading dot) in .IR /usr/local/lib/mg . .Pp See the manual for a full list of the commands that can go in the files. The most commonly used ones are probably key binding. The following example is part of a configuration file used to set make .Nm respond to the keypad on a Microport SV/AT system. The normal keys send a sequence of the form [ . I also want to use keys prefixed by as having different meaning. In order to deal with multi-character sequences, the initial subsequences must be defined as prefixes. To allow for this, three prefixes are left undefined in the initial setup. They are called "extra prefix 1", etc. .Bd -literal -offset indent ;allow normal pad global-set-key ^[[ "extra prefix 1" ;allow prefixed pad global-set-key ^[^[ "extra prefix 2" global-set-key ^[^[[ "extra prefix 3" ;keypad global-set-key ^[[A previous-line global-set-key ^[[H scroll-down ...etc ;escaped keypad global-set-key ^[^[[A exchange-point-and-mark global-set-key ^[^[[H beginning-of-buffer .Ed .Pp Here's another example sequence that you may find useful. By default () and [] are recognized as brackets, so bracket matching can be done. The following defines {} as brackets, and turns on the mode that causes the cursor to "blink" to show you matching brackets. .Bd -literal -offset indent global-set-key } blink-matching-paren-hack blink-matching-paren set-default-mode blink .Ed .Pp .Sh ARGUMENTS .Nm does not take any options. The only arguments you can pass it are file names. It will do a find-file on each one, reading it into a buffer. It will leave the last buffer on the screen. .Sh "SEE ALSO" .Xr vi 1 .Sh BUGS When you type ? to list possible file names, buffer names, etc., a help buffer is created for the possibilities. In Gnu Emacs, this buffer goes away the next time you type a real command. In .Nm , you must use "m-x 1" to get rid of it. .Sh FILES .Pp .Bl -tag -width /etc/passwd -compact .It ~/.mg normal startup file .It ~/.mg-TERM terminal-specific startup file .It /usr/local/lib/mg Directory for system-wide startup files. (Files in this directory do not have the leading dot). .El