MG(1)

NAME
mg - emacs-like text editor

SYNOPSIS
mg [file ...]

DESCRIPTION
mg is intended to be a small, fast, and portable editor for people who can't (or don't want to) run the real emacs for one reason or another, or are not familiar with the vi(1) editor. It is compatible with emacs because there shouldn't be any reason to learn more editor types than emacs or vi(1).

Normal editing commands are very similar to Gnu Emacs. In the following examples, ^X means control-X, and M-X means Meta-X, where the Meta key may be either a special key on your keyboard or the ALT key; otherwise ESC followed by the key X works as well.

^f  Forward character
^b  Backwards character
^n  Next line
^p  Previous line
^a  Start of line
^e  End of line
^d  delete current character
^s  interactive search forward
^r  interactive search backwards
^o  Open a new line at cursor position
^t  transpose characters
^u  Repeat next command 4 times (can be cascaded, ie. ^u^u^f will move 16 characters forward)

^k  kill to end of line (placing into kill buffer)
^y  yank kill buffer into current location
^@  set mark
^w  kill region (cuts from previously set mark to current location, into kill buffer)
M-w copy region (into kill buffer)

^v  Next page
M-v Previous page
M-< start of buffer
M-> end of buffer

^x^c
    Quit (you will be asked if you want to save files)

For more key bindings, type “M-x describe-bindings”.

mg 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. Since it is written completely in C, 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 the spacebar and ‘’?, respectively.

Amongst other major differences, the mg configuration files are much simpler than real emacs. There are two configuration files, .mg, and .mg-TERM. Here, TERM represents the name of you terminal type; e.g., if your terminal type is set to “vt100”, mg will use .mg-vt100 as a startup file. The terminal type startup file is used first. See the manual for a full list of the commands that can go in the files.

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.

    global-set-key } blink-matching-paren-hack
    blink-matching-paren
    set-default-mode blink

FILES
~/.mg
    normal startup file
~/.mg-TERM
    terminal-specific startup file

SEE ALSO
vi(1)

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 mg, you must use "M-x 1" to get rid of it.