[BACK]Return to mg.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Annotation of src/usr.bin/mg/mg.1, Revision 1.39

1.39    ! jmc         1: .\"    $OpenBSD: mg.1,v 1.38 2008/06/15 07:53:58 kjell Exp $
1.34      kjell       2: .\" This file is in the public domain.
1.9       niklas      3: .\"
1.38      kjell       4: .Dd $Mdocdate: June 15 2008 $
1.2       deraadt     5: .Dt MG 1
                      6: .Os
                      7: .Sh NAME
                      8: .Nm mg
                      9: .Nd emacs-like text editor
                     10: .Sh SYNOPSIS
                     11: .Nm mg
1.36      sobrado    12: .Op Fl n
                     13: .Op Fl f Ar mode
                     14: .Op + Ns Ar number
                     15: .Op Ar
1.2       deraadt    16: .Sh DESCRIPTION
                     17: .Nm
1.3       aaron      18: is intended to be a small, fast, and portable editor for
1.33      kjell      19: people who can't (or don't want to) run emacs for one
1.2       deraadt    20: reason or another, or are not familiar with the
                     21: .Xr vi 1
1.6       aaron      22: editor.
                     23: It is compatible with emacs because there shouldn't
1.2       deraadt    24: be any reason to learn more editor types than emacs or
                     25: .Xr vi 1 .
1.16      deraadt    26: .Pp
1.17      vincent    27: The options are as follows:
1.21      henning    28: .Bl -tag -width Ds
1.36      sobrado    29: .It + Ns Ar number
1.16      deraadt    30: Go to the line specified by number (do not insert
1.33      kjell      31: a space between the
                     32: .Sq +
                     33: sign and the number).
1.20      mjc        34: If a negative number is specified, the line number counts
                     35: backwards from the end of the file i.e. +-1 will be the last
                     36: line of the file, +-2 will be second last, and so on.
1.36      sobrado    37: .It Fl f Ar mode
1.17      vincent    38: Run the mode command for all buffers created from
                     39: arguments on the command line, including the
                     40: scratch buffer and all files.
1.21      henning    41: .It Fl n
                     42: Turn off backup file generation.
1.16      deraadt    43: .El
1.33      kjell      44: .Sh WINDOWS AND BUFFERS
                     45: When a file is loaded into
                     46: .Nm ,
                     47: it is stored in a
                     48: .Em buffer .
                     49: This buffer may be displayed on the screen in more than one window.
                     50: At present, windows may only be split horizontally, so each window is
                     51: delineated by a modeline at the bottom.
                     52: If changes are made to a buffer, it will be reflected in all open windows.
                     53: .Sh POINT AND MARK
                     54: The current cursor location in
                     55: .Nm
                     56: is called the
1.39    ! jmc        57: .Em point
1.37      kjell      58: (or
                     59: .Em dot ) .
1.33      kjell      60: It is possible to define a window-specific region of text by setting a second
                     61: location, called the
                     62: .Em mark .
                     63: The
                     64: .Em region
                     65: is the text between point and mark inclusive.
                     66: Deleting the character at the mark position leaves
                     67: the mark at the point of deletion.
                     68: .Pp
                     69: Note: The point and mark are window-specific in
                     70: .Nm ,
                     71: not buffer-specific, as in other emacs flavours.
                     72: .Sh DEFAULT KEY BINDINGS
1.6       aaron      73: Normal editing commands are very similar to Gnu Emacs.
1.37      kjell      74: In the following examples, C-x means control-X, and M-x means Meta-X,
1.4       deraadt    75: where the Meta key may be either a special key on your keyboard
                     76: or the ALT key; otherwise ESC followed by the key X works as well.
                     77: .Pp
1.37      kjell      78: .Bl -tag -width xxxxxxxxxx -compact
                     79: .It C-SPC
                     80: set-mark-command
                     81: .It C-a
                     82: beginning-of-line
                     83: .It C-b
                     84: backward-char
                     85: .It C-d
                     86: delete-char
                     87: .It C-e
                     88: end-of-line
                     89: .It C-f
                     90: forward-char
                     91: .It C-g
                     92: keyboard-quit
                     93: .It C-h C-h
                     94: help-help
                     95: .It C-h a
                     96: apropos
                     97: .It C-h b
                     98: describe-bindings
                     99: .It C-h c
                    100: describe-key-briefly
                    101: .It C-j
                    102: newline-and-indent
                    103: .It C-k
                    104: kill-line
                    105: .It C-l
                    106: recenter
                    107: .It RET
                    108: newline
                    109: .It C-n
                    110: next-line
                    111: .It C-o
                    112: open-line
                    113: .It C-p
                    114: previous-line
                    115: .It C-q
                    116: quoted-insert
                    117: .It C-r
                    118: isearch-backward
                    119: .It C-s
                    120: isearch-forward
                    121: .It C-t
                    122: transpose-chars
                    123: .It C-u
                    124: universal-argument
                    125: .It C-v
                    126: scroll-up
                    127: .It C-w
                    128: kill-region
                    129: .It C-x C-b
                    130: list-buffers
                    131: .It C-x C-c
                    132: save-buffers-kill-emacs
                    133: .It C-x C-f
                    134: find-file
                    135: .It C-x C-g
                    136: keyboard-quit
                    137: .It C-x C-l
                    138: downcase-region
                    139: .It C-x C-o
                    140: delete-blank-lines
                    141: .It C-x C-q
                    142: toggle-read-only
                    143: .It C-x C-r
                    144: find-file-read-only
                    145: .It C-x C-s
                    146: save-buffer
                    147: .It C-x C-u
                    148: upcase-region
                    149: .It C-x C-v
                    150: find-alternate-file
                    151: .It C-x C-w
                    152: write-file
                    153: .It C-x C-x
                    154: exchange-point-and-mark
                    155: .It C-x (
                    156: start-kbd-macro
                    157: .It C-x )
                    158: end-kbd-macro
                    159: .It C-x 0
                    160: delete-window
                    161: .It C-x 1
                    162: delete-other-windows
                    163: .It C-x 2
                    164: split-window-vertically
                    165: .It C-x 4 C-f
                    166: find-file-other-window
                    167: .It C-x 4 C-g
                    168: keyboard-quit
                    169: .It C-x 4 b
                    170: switch-to-buffer-other-window
                    171: .It C-x 4 f
                    172: find-file-other-window
                    173: .It C-x =
                    174: what-cursor-position
                    175: .It C-x ^
                    176: enlarge-window
                    177: .It C-x `
                    178: next-error
                    179: .It C-x b
                    180: switch-to-buffer
                    181: .It C-x d
                    182: dired
                    183: .It C-x e
                    184: call-last-kbd-macro
                    185: .It C-x f
                    186: set-fill-column
                    187: .It C-x g
                    188: goto-line
                    189: .It C-x i
                    190: insert-file
                    191: .It C-x k
                    192: kill-buffer
                    193: .It C-x n
                    194: other-window
                    195: .It C-x o
                    196: other-window
                    197: .It C-x p
                    198: previous-window
                    199: .It C-x s
                    200: save-some-buffers
                    201: .It C-x u
                    202: undo
                    203: .It C-y
                    204: yank
                    205: .It C-z
                    206: suspend-emacs
                    207: .It M-C-v
                    208: scroll-other-window
                    209: .It M-SPC
                    210: just-one-space
1.23      deraadt   211: .It M-%
1.37      kjell     212: query-replace
1.4       deraadt   213: .It M-<
1.37      kjell     214: beginning-of-buffer
1.4       deraadt   215: .It M->
1.37      kjell     216: end-of-buffer
                    217: .It M-\e
                    218: delete-horizontal-space
                    219: .It M-b
                    220: backward-word
                    221: .It M-c
                    222: capitalize-word
                    223: .It M-d
                    224: kill-word
                    225: .It M-f
                    226: forward-word
                    227: .It M-l
                    228: downcase-word
                    229: .It M-q
                    230: fill-paragraph
                    231: .It M-r
                    232: search-backward
                    233: .It M-s
                    234: search-forward
                    235: .It M-u
                    236: upcase-word
                    237: .It M-v
                    238: scroll-down
                    239: .It M-w
                    240: copy-region-as-kill
                    241: .It M-x
                    242: execute-extended-command
                    243: .It M-{
                    244: backward-paragraph
                    245: .It M-}
                    246: forward-paragraph
                    247: .It M-~
                    248: not-modified
                    249: .It M-DEL
                    250: backward-kill-word
                    251: .It C-_
                    252: undo
                    253: .It )
                    254: blink-and-insert
                    255: .It DEL
                    256: delete-backward-char
1.4       deraadt   257: .El
                    258: .Pp
1.37      kjell     259: For a complete description of
                    260: .Nm
                    261: commands, see
                    262: .Sx MG COMMANDS .
                    263: To see the active keybindings at any time, type
1.4       deraadt   264: .Dq M-x describe-bindings .
1.37      kjell     265: .Sh MG COMMANDS
1.33      kjell     266: Commands are invoked by
                    267: .Dq M-x ,
                    268: or by binding to a key.
                    269: Many commands take an optional numerical parameter,
                    270: .Va n .
                    271: This parameter is set either by
                    272: M-<n> (where
                    273: .Va n
                    274: is the numerical argument) before the command, or by
                    275: one or more invocations of the universal argument, usually bound to C-U.
                    276: When invoked in this manner, the value of the numeric parameter to
                    277: be passed is displayed in the minibuffer before the M-x.
1.39    ! jmc       278: One common use of the parameter is in mode toggles (e.g.\&
1.37      kjell     279: make-backup-files).
                    280: If no parameter is supplied, the mode is toggled to its
                    281: alternate state.
                    282: If a positive parameter is supplied, the mode is forced to on.
                    283: Otherwise, it is forced to off.
                    284: .\"
                    285: .Bl -tag -width xxxxx
                    286: .It apropos
                    287: Help Apropos.
                    288: Prompt the user for a string, open the *help* buffer,
                    289: and list all
                    290: .Nm
                    291: commands that contain that string.
                    292: .It auto-execute
                    293: Register an auto-execute hook; that is, specify a filename pattern
                    294: (conforming to the shell's filename globbing rules) and an associated
                    295: function to execute when a file matching the specified pattern
                    296: is read into a buffer.
                    297: .It auto-fill-mode
                    298: Toggle auto-fill mode (sometimes called mail-mode),
                    299: where text inserted past the fill column is automatically wrapped
                    300: to a new line.
                    301: .It auto-indent-mode
1.39    ! jmc       302: Toggle indent mode, where indentation is preserved after a newline.
1.37      kjell     303: .It backward-char
                    304: Move cursor backwards one character.
                    305: .It backward-kill-word
                    306: Kill text backwards by
                    307: .Va n
                    308: words.
                    309: .It backward-paragraph
                    310: Move cursor backwards
                    311: .Va n
                    312: paragraphs.
                    313: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
                    314: .It backward-word
                    315: Move cursor backwards by the specified number of words.
                    316: .It beginning-of-buffer
                    317: Move cursor to the top of the buffer.
                    318: .It beginning-of-line
                    319: Move cursor to the beginning of the line.
                    320: .It blink-and-insert
                    321: Self-insert a character, then search backwards and blink its
                    322: matching delimeter.
                    323: For delimeters other than
                    324: parenthesis, brackets, and braces, the character itself
                    325: is used as its own match.
                    326: .It bsmap-mode
                    327: Toggle bsmap mode, where DEL and c-H are swapped.
                    328: .It call-last-kbd-macro
                    329: Invoke the keyboard macro.
                    330: .It capitalize-word
                    331: Capitalize
                    332: .Va n
                    333: words; i.e. convert the first character of the word to
                    334: upper case, and subsequent letters to lower case.
                    335: .It cd
                    336: Change the global working directory.
                    337: See also global-wd-mode.
                    338: .It copy-region-as-kill
                    339: Copy all of the characters in the region to the kill buffer,
                    340: clearing the mark afterwards.
                    341: This is a bit like a kill-region followed by a yank.
                    342: .It count-matches
                    343: Count the number of lines matching the supplied regular expression.
                    344: .It count-non-matches
                    345: Count the number of lines not matching the supplied regular expression.
                    346: .It define-key
1.39    ! jmc       347: Prompts the user for a named keymap (mode),
1.37      kjell     348: a key, and an mg command, then creates a keybinding in the appropriate
                    349: map.
                    350: .It delete-backward-char
                    351: Delete backwards
                    352: .Va n
                    353: characters.
                    354: Like delete-char, this actually does a kill if presented
                    355: with an argument.
                    356: .It delete-blank-lines
                    357: Delete blank lines around dot.
                    358: If dot is sitting on a blank line, this command
                    359: deletes all the blank lines above and below the current line.
                    360: Otherwise, it deletes all of the blank lines after the current line.
                    361: .It delete-char
                    362: Delete
                    363: .Va n
                    364: characters forward.
                    365: If any argument is present, it kills rather than deletes,
                    366: saving the result in the kill buffer.
                    367: .It delete-horizontal-space
                    368: Delete any whitespace around the dot.
                    369: .It delete-leading-space
                    370: Delete leading whitespace on the current line.
                    371: .It delete-trailing-space
                    372: Delete trailing whitespace on the current line.
                    373: .It delete-matching-lines
                    374: Delete all lines after dot that contain a string matching
                    375: the supplied regular expression.
                    376: .It delete-non-matching-lines
                    377: Delete all lines after dot that contain a string matching
                    378: the supplied regular expression.
                    379: .It delete-other-windows
                    380: Make the current window the only window visible on the screen.
                    381: .It delete-window
                    382: Delete current window.
                    383: .It describe-bindings
                    384: List all global and local keybindings, putting the result in
                    385: the *help* buffer.
                    386: .It describe-key-briefly
                    387: Read a key from the keyboard, and look it up in the keymap.
                    388: Display the name of the function currently bound to the key.
                    389: .It digit-argument
                    390: Process a numerical argument for keyboard-invoked functions.
                    391: .It downcase-region
                    392: Set all characters in the region to lower case.
                    393: .It downcase-word
                    394: Set characters to lower case, starting at the dot, and ending
                    395: .Va n
                    396: words away.
                    397: .It emacs-version
                    398: Return an mg version string.
                    399: .It end-kbd-macro
                    400: Stop defining a keyboard macro.
                    401: .It end-of-buffer
                    402: Move cursor to the end of the buffer.
                    403: .It end-of-line
                    404: Move cursor to the end of the line
                    405: .It enlarge-window
                    406: Enlarge the current window by shrinking either the window above
                    407: or below it.
                    408: .It eval-current-buffer
                    409: Evaluate the current buffer as a series of mg commands.
                    410: Useful for testing
                    411: .Nm
                    412: startup files.
                    413: .It eval-expression
                    414: Get one line from the user, and run it.
                    415: Useful for testing expressions in
                    416: .Nm
                    417: startup files.
                    418: .It exchange-point-and-mark
                    419: Swap the values of "dot" and "mark" in the current window.
                    420: Return an error if no mark is set.
                    421: .It execute-extended-command
                    422: Invoke an extended command; i.e. M-x.
                    423: Call the message line routine to read in the command name and apply
                    424: autocompletion to it.
                    425: When it comes back, look the name up in the symbol table and run the
                    426: command if it is found, passing arguments as necessary.
                    427: Print an error if there is anything wrong.
                    428: .It fill-paragraph
                    429: Justify a paragraph, wrapping text at the current fill column.
                    430: .It find-file
                    431: Select a file for editing.
                    432: First check if you can find the file
                    433: in another buffer; if you can find it, just switch to the buffer.
1.39    ! jmc       434: If you cannot find the file, create a new buffer, read in the
1.37      kjell     435: file from disk, and switch to the new buffer.
                    436: .It find-file-read-only
                    437: Same as find-file, except the new buffer is set to read-only.
                    438: .It find-alternate-file
                    439: Replace the current file with an alternate one.
                    440: Semantics for finding the replacement file are the same as
1.39    ! jmc       441: find-file, except the current buffer is killed before the switch.
1.37      kjell     442: If the kill fails, or is aborted, revert to the original file.
                    443: .It find-file-other-window
                    444: Opens the specified file in a second buffer.
                    445: Splits the current window if necessary.
                    446: .It forward-char
                    447: Move cursor forwards (or backwards, if
                    448: .Va n
                    449: is negative)
                    450: .Va n
                    451: characters.
                    452: Returns an error if the end of buffer is reached.
                    453: .It forward-paragraph
                    454: Move forward
                    455: .Va n
                    456: paragraphs.
1.39    ! jmc       457: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
1.37      kjell     458: .It forward-word
                    459: Move the cursor forward by the specified number of words.
                    460: .It global-set-key
                    461: Bind a key in the global (fundamental) key map.
                    462: .It global-unset-key
                    463: Unbind a key from the global (fundamental) key map; i.e. set it to 'rescan'
                    464: .It global-wd-mode
                    465: Toggle global working-directory mode.
                    466: When enabled,
                    467: .Nm
                    468: defaults to opening files (and executing commands like compile and grep)
1.39    ! jmc       469: relative to the global working directory.
1.37      kjell     470: When disabled, a working directory is set for each buffer.
                    471: .It goto-line
                    472: Go to a specific line.
                    473: If an argument is present, then
                    474: it is the line number, else prompt for a line number to use.
                    475: .It help-help
1.39    ! jmc       476: Prompts for one of (a)propos, (b)indings, des(c)ribe key briefly.
1.37      kjell     477: .It insert
                    478: Insert a string, mainly for use from macros.
                    479: .It insert-buffer
                    480: Insert the contents of another buffer at dot
                    481: .It insert-file
                    482: Insert a file into the current buffer at dot.
                    483: .It insert-with-wrap
                    484: Insert the bound character with word wrap.
                    485: Check to see if we're past the fill column, and if so,
                    486: justify this line.
                    487: .It isearch-backward
                    488: Use incremental searching, initially in the reverse direction.
                    489: isearch ignores any explicit arguments.
1.39    ! jmc       490: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     491: search-backward is invoked instead.
                    492: .It isearch-forward
                    493: Use incremental searching, initially in the forward direction.
                    494: isearch ignores any explicit arguments.
1.39    ! jmc       495: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     496: search-forward is invoked instead.
                    497: .It just-one-space
                    498: Delete any whitespace around dot, then insert a space.
                    499: .It keyboard-quit
                    500: Abort the current action.
                    501: .It kill-buffer
                    502: Dispose of a buffer, by name.
                    503: Prompt the user if the buffer
                    504: has been changed.
                    505: .It kill-line
                    506: Kill line.
                    507: If called without an argument, it kills from dot to the end
                    508: of the line, unless it is at the end of the line, when it kills the
                    509: newline.
                    510: If called with an argument of 0, it kills from the start of the
                    511: line to dot.
                    512: If called with a positive argument, it kills from dot
                    513: forward over that number of newlines.
                    514: If called with a negative argument
                    515: it kills any text before dot on the current line, then it kills back
                    516: abs(n) lines.
                    517: .It kill-paragraph
                    518: Delete
                    519: .Va n
                    520: paragraphs starting with the current one.
                    521: .It kill-region
1.39    ! jmc       522: Kill the currently defined region.
1.37      kjell     523: .It kill-word
                    524: Delete forward
                    525: .Va n
                    526: words.
                    527: .It line-number-mode
1.39    ! jmc       528: Toggle whether line and column numbers are displayed in the modeline.
1.37      kjell     529: .It list-buffers
                    530: Display the list of available buffers.
                    531: .It load
                    532: Prompt the user for a filename, and then execute commands
                    533: from that file.
                    534: .It local-set-key
                    535: Bind a key mapping in the local (topmost) mode.
                    536: .It local-unset-key
                    537: Unbind a key mapping in the local (topmost) mode.
                    538: .It make-backup-files
                    539: Toggle generation of backup files.
                    540: .It meta-key-mode
                    541: When disabled, the meta key can be used to insert extended-ascii (8-bit)
                    542: characters.
                    543: When enabled, the meta key acts as usual.
                    544: .It negative-argument
1.39    ! jmc       545: Process a negative argument for keyboard-invoked functions.
1.37      kjell     546: .It newline
                    547: Insert a newline into the current buffer.
                    548: .It newline-and-indent
                    549: Insert a newline, then enough tabs and spaces to duplicate the indentation
                    550: of the previous line.
                    551: Assumes tabs are every eight characters.
                    552: .It next-line
                    553: Move forward
                    554: .Va n
                    555: lines.
                    556: .It no-tab-mode
                    557: Toggle notab mode.
                    558: In this mode, spaces are inserted rather than tabs.
                    559: .It not-modified
                    560: Turn off the modified flag in the current buffer.
                    561: .It open-line
                    562: Open up some blank space.
                    563: Essentially, insert
                    564: .Va n
                    565: newlines, then back up over them.
                    566: .It other-window
                    567: The command to make the next (down the screen) window the current
                    568: window.
                    569: There are no real errors, although the command does nothing if
                    570: there is only 1 window on the screen.
                    571: .It overwrite-mode
1.39    ! jmc       572: Toggle overwrite mode, where typing in a buffer overwrites
1.37      kjell     573: existing characters rather than inserting them.
                    574: .It prefix-region
                    575: Inserts a prefix string before each line of a region.
                    576: The prefix string is settable by using 'set-prefix-string'.
                    577: .It previous-line
                    578: Move backwards
                    579: .Va n
                    580: lines.
                    581: .It previous-window
                    582: This command makes the previous (up the screen) window the
                    583: current window.
                    584: There are no errors, although the command does not do
                    585: a lot if there is only 1 window.
                    586: .It push-shell
                    587: Suspend mg and switch to alternate screen, if available.
                    588: .It pwd
                    589: Display current (global) working directory in the status area.
                    590: .It query-replace
                    591: Query Replace.
                    592: Search and replace strings selectively, prompting after each match.
                    593: .It replace-string
                    594: Replace string globally without individual prompting.
                    595: .It query-replace-regexp
                    596: Replace strings selectively.
                    597: Does a search and replace operation using regular
                    598: expressions for both patterns.
                    599: .It quoted-insert
                    600: Insert the next character verbatim into the current buffer; i.e. ignore
                    601: any function bound to that key.
                    602: .It re-search-again
                    603: Perform a regular expression search again, using the same search
                    604: string and direction as the last search command.
                    605: .It re-search-backward
                    606: Search backwards using a regular expression.
                    607: Get a search string from the user, and search, starting at dot
                    608: and proceeding toward the front of the buffer.
1.39    ! jmc       609: If found, dot is left
1.37      kjell     610: pointing at the first character of the pattern [the last character that
                    611: was matched].
                    612: .It re-search-forward
                    613: Search forward using a regular expression.
                    614: Get a search string from the user and search for it starting at dot.
                    615: If found, move dot to just after the matched characters.
                    616: display does all
                    617: the hard stuff.
                    618: If not found, it just prints a message.
                    619: .It recenter
                    620: Reposition dot in the current window.
1.39    ! jmc       621: By default, the dot is centered.
1.37      kjell     622: If given a positive argument (n), the display is repositioned to line
                    623: n.
                    624: If
                    625: .Va n
                    626: is negative, it is that line from the bottom
                    627: .It redraw-display
                    628: Refresh the display.
                    629: Recomputes all window sizes in case something has changed.
                    630: .It save-buffer
                    631: Save the contents of the current buffer if it has been changed,
                    632: optionally creating a backup copy.
                    633: .It save-buffers-kill-emacs
                    634: Offer to save modified buffers and quit mg.
                    635: .It save-some-buffers
                    636: Look through the list of buffers, offering to save any buffer that
                    637: has been changed.
                    638: Buffers that are not associated with files (such
                    639: as *scratch*, *grep*, *compile*) are ignored.
                    640: .It scroll-down
                    641: Scroll backwards
                    642: .Va n
                    643: pages.
                    644: A two-line overlap between pages is
                    645: assumed.
                    646: If given a repeat argument, scrolls back lines, not pages.
                    647: .It scroll-one-line-down
                    648: Scroll the display down
                    649: .Va n
                    650: lines without changing the cursor position.
                    651: .It scroll-one-line-up
                    652: Scroll the display
                    653: .Va n
                    654: lines up without moving the cursor position
                    655: .It scroll-other-window
                    656: Scroll the next window in the window list window forward
                    657: .Va n
                    658: pages.
                    659: .It scroll-up
                    660: Scroll forward one page.
                    661: A two-line overlap between pages is
                    662: assumed.
                    663: If given a repeat argument, scrolls back lines, not pages.
                    664: .It search-again
                    665: Search again, using the same search string and direction as the last
                    666: search command.
                    667: .It search-backward
                    668: Reverse search.
                    669: Get a search string from the user, and search, starting
                    670: at dot and proceeding toward the front of the buffer.
                    671: If found, dot is
                    672: left pointing at the first character of the pattern (the last character
                    673: that was matched).
                    674: .It search-forward
                    675: Search forward.
                    676: Get a search string from the user, and search for it
                    677: starting at dot.
                    678: If found, dot gets moved to just after the matched
                    679: characters, if not found, print a message.
                    680: .It self-insert-command
                    681: Insert a character.
                    682: .It set-case-fold-search
                    683: Set case-fold searching, causing case nopt to matter
                    684: in regular expression searches.
                    685: This is the default.
                    686: .It set-default-mode
                    687: Append the supplied mode to the list of default modes
                    688: used by subsequent buffer creation.
                    689: Built in modes include: fill, indent, overwrite, and notab.
                    690: .It set-fill-column
                    691: Prompt the user for a fill column.
                    692: Used by auto-fill-mode.
                    693: .It set-mark-command
                    694: Sets the mark in the current window to the current dot location
                    695: .It set-prefix-string
                    696: Sets the prefix string to be used by the 'prefix-region' command.
                    697: .It shrink-window
                    698: Shrink current window by one line.
                    699: The window immediately below is expanded to pick up the slack.
                    700: If only one window is present, this command has no effect.
                    701: .It space-to-tabstop
                    702: Insert enough spaces to reach the next tab-stop position.
                    703: By default, tab-stops occur every 8 characters.
                    704: .It split-window-vertically
                    705: Split the current window.
                    706: A window smaller than 3 lines cannot be split.
                    707: .It start-kbd-macro
                    708: Start defining a keyboard macro.
                    709: Macro definition is ended by invoking end-kbd-macro.
                    710: .It suspend-emacs
                    711: Suspend mg and switch back to alternate screen, if in use.
                    712: .It switch-to-buffer
                    713: Prompt and switch to a new buffer in the current window.
                    714: .It switch-to-buffer-other-window
                    715: Switch to buffer in another window.
                    716: .It toggle-read-only
                    717: Toggle the read-only flag on the current buffer.
                    718: .It transpose-chars
                    719: Transpose the two characters on either side of dot.
1.39    ! jmc       720: If dot is at the end of the line, transpose the two characters before it.
1.37      kjell     721: Return with an error if dot is at the beginning of line;
1.39    ! jmc       722: it seems to be a bit pointless to
1.37      kjell     723: make this work.
                    724: .It undo
                    725: Undo the most recent action.
                    726: If invoked again without an intervening command,
                    727: move the undo pointer to the previous action and undo it.
                    728: .It undo-list
                    729: Show the undo records for the current buffer in a new buffer.
                    730: .It universal-argument
                    731: Repeat the next command 4 times.
                    732: Usually bound to C-u.
1.39    ! jmc       733: This command may be stacked; e.g.\&
1.37      kjell     734: C-u C-u C-f moves the cursor forward 16 characters.
                    735: .It upcase-region
                    736: Upper case region.
                    737: Change all of the lower case characters in the region to
                    738: upper case
                    739: .It upcase-word
                    740: Move the cursor forward by the specified number of words.
                    741: As you move, convert any characters to upper case.
                    742: .It what-cursor-position
                    743: Display a bunch of useful information about the current location of
                    744: dot.
                    745: The character under the cursor (in octal), the current line, row,
                    746: and column, and approximate position of the cursor in the file (as a
                    747: percentage) is displayed.
                    748: The column position assumes an infinite
                    749: position display; it does not truncate just because the screen does.
                    750: .It write-file
                    751: Ask for a file name and write the contents of the current buffer to
                    752: that file.
                    753: Update the remembered file name and clear the buffer
                    754: changed flag.
                    755: .It yank
                    756: Yank text from kill-buffer.
                    757: Unlike emacs, the mg kill buffer consists only
                    758: of the most recent kill.
                    759: It is not a ring.
                    760: .El
1.33      kjell     761: .Sh CONFIGURATION FILES
1.7       aaron     762: There are two configuration files,
1.3       aaron     763: .Pa .mg ,
1.1       deraadt   764: and
1.3       aaron     765: .Pa .mg-TERM .
                    766: Here,
                    767: .Ev TERM
1.15      pvalchev  768: represents the name of your terminal type; e.g., if your terminal type
1.3       aaron     769: is set to
                    770: .Dq vt100 ,
1.2       deraadt   771: .Nm
1.1       deraadt   772: will use
1.3       aaron     773: .Pa .mg-vt100
1.6       aaron     774: as a startup file.
                    775: The terminal type startup file is used first.
1.33      kjell     776: .Pp
1.28      jmc       777: The startup file format is a list of commands, one per line, as used for
1.33      kjell     778: interactive evaluation.
                    779: Strings that are normally entered by the user at any subsequent prompts
                    780: may be specified after the command name; e.g.:
1.28      jmc       781: .Bd -literal -offset indent
1.37      kjell     782: global-set-key ")" self-insert-command
1.38      kjell     783: global-set-key "\\^x\\^f" find-file
                    784: global-set-key "\\e[Z" backward-char
1.37      kjell     785: set-default-mode fill
1.28      jmc       786: set-fill-column 72
1.37      kjell     787: auto-execute *.c c-mode
1.28      jmc       788: .Ed
1.3       aaron     789: .Sh FILES
1.8       aaron     790: .Bl -tag -width ~/.mg-TERM -compact
1.3       aaron     791: .It Pa ~/.mg
                    792: normal startup file
                    793: .It Pa ~/.mg-TERM
                    794: terminal-specific startup file
                    795: .El
                    796: .Sh SEE ALSO
1.2       deraadt   797: .Xr vi 1
1.29      reyk      798: .Sh CAVEATS
1.37      kjell     799: Since it is written completely in C, there is currently no
1.33      kjell     800: language in which you can write extensions;
1.38      kjell     801: however, you can rebind keys and change certain parameters
                    802: in startup files.
1.33      kjell     803: .Pp
                    804: In order to use 8-bit characters (such as German umlauts), the Meta key
                    805: needs to be disabled via the
                    806: .Dq meta-key-mode
                    807: command.