[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.71

1.71    ! florian     1: .\"    $OpenBSD: mg.1,v 1.70 2012/10/22 08:31:42 florian Exp $
1.34      kjell       2: .\" This file is in the public domain.
1.9       niklas      3: .\"
1.71    ! florian     4: .Dd $Mdocdate: October 22 2012 $
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.
1.70      florian    53: .Pp
                     54: If a file is changed outside
                     55: .Nm
                     56: and its buffer is about to be changed,
                     57: .Nm
                     58: prompts if the change should go ahead (y), not go ahead (n) or if the buffer
                     59: should be reverted (r) to the latest file on disk.
1.43      kjell      60: .Pp
                     61: If a buffer name begins and ends with an asterisk, the buffer is considered
1.44      jmc        62: throwaway; i.e. the user will not be prompted to save changes when
1.43      kjell      63: the buffer is killed.
1.33      kjell      64: .Sh POINT AND MARK
                     65: The current cursor location in
                     66: .Nm
                     67: is called the
1.39      jmc        68: .Em point
1.37      kjell      69: (or
                     70: .Em dot ) .
1.33      kjell      71: It is possible to define a window-specific region of text by setting a second
                     72: location, called the
                     73: .Em mark .
                     74: The
                     75: .Em region
                     76: is the text between point and mark inclusive.
                     77: Deleting the character at the mark position leaves
                     78: the mark at the point of deletion.
                     79: .Pp
                     80: Note: The point and mark are window-specific in
                     81: .Nm ,
                     82: not buffer-specific, as in other emacs flavours.
1.64      lum        83: .Sh BACKUP FILES
1.65      jmc        84: Backup files have a
                     85: .Sq ~
                     86: character appended to the file name and
1.64      lum        87: are created in the current working directory by default.
                     88: Whether to create backup files or not can be toggled with the
                     89: make-backup-file command.
                     90: The backup file location can either be in the current
1.65      jmc        91: working directory, or all backups can be moved to a
                     92: .Pa ~/.mg.d
                     93: directory where files retain their path name to retain uniqueness.
1.64      lum        94: Use the backup-to-home-directory to alternate between these two locations.
1.65      jmc        95: Further, if any application creates backup files in the
                     96: .Ev TMPDIR ,
1.64      lum        97: these can be left with the leave-tmpdir-backups command.
1.56      lum        98: .Sh TAGS
                     99: .Nm
1.57      lum       100: supports tag files created by
1.56      lum       101: .Xr ctags 1 ,
1.57      lum       102: allowing the user to quickly locate various object definitions.
                    103: Note though that emacs uses etags, not ctags.
1.61      lum       104: .Sh CSCOPE
                    105: .Nm
                    106: supports navigating source code using cscope.
                    107: However,
                    108: .Nm
                    109: requires cscope and cscope-indexer executables to be present in
                    110: .Ev PATH
                    111: for it to work.
1.33      kjell     112: .Sh DEFAULT KEY BINDINGS
1.53      lum       113: Normal editing commands are very similar to GNU Emacs.
1.47      sobrado   114: In the following examples, C-x means Control-x, and M-x means Meta-x,
1.54      lum       115: where the Meta key may be either a special key on the keyboard
1.4       deraadt   116: or the ALT key; otherwise ESC followed by the key X works as well.
                    117: .Pp
1.66      jmc       118: .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
1.37      kjell     119: .It C-SPC
                    120: set-mark-command
                    121: .It C-a
                    122: beginning-of-line
                    123: .It C-b
                    124: backward-char
1.61      lum       125: .It C-c s c
                    126: cscope-find-functions-calling-this-function
                    127: .It C-c s d
                    128: cscope-find-global-definition
                    129: .It C-c s e
                    130: cscope-find-egrep-pattern
                    131: .It C-c s f
                    132: cscope-find-this-file
                    133: .It C-c s i
                    134: cscope-find-files-including-file
                    135: .It C-c s n
                    136: cscope-next-symbol
                    137: .It C-c s p
                    138: cscope-prev-symbol
                    139: .It C-c s s
                    140: cscope-find-this-symbol
                    141: .It C-c s t
                    142: cscope-find-this-text-string
1.37      kjell     143: .It C-d
                    144: delete-char
                    145: .It C-e
                    146: end-of-line
                    147: .It C-f
                    148: forward-char
                    149: .It C-g
                    150: keyboard-quit
                    151: .It C-h C-h
                    152: help-help
                    153: .It C-h a
                    154: apropos
                    155: .It C-h b
                    156: describe-bindings
                    157: .It C-h c
                    158: describe-key-briefly
                    159: .It C-j
                    160: newline-and-indent
                    161: .It C-k
                    162: kill-line
                    163: .It C-l
                    164: recenter
                    165: .It RET
                    166: newline
                    167: .It C-n
                    168: next-line
                    169: .It C-o
                    170: open-line
                    171: .It C-p
                    172: previous-line
                    173: .It C-q
                    174: quoted-insert
                    175: .It C-r
                    176: isearch-backward
                    177: .It C-s
                    178: isearch-forward
                    179: .It C-t
                    180: transpose-chars
                    181: .It C-u
                    182: universal-argument
                    183: .It C-v
                    184: scroll-up
                    185: .It C-w
                    186: kill-region
                    187: .It C-x C-b
                    188: list-buffers
                    189: .It C-x C-c
                    190: save-buffers-kill-emacs
                    191: .It C-x C-f
                    192: find-file
                    193: .It C-x C-g
                    194: keyboard-quit
                    195: .It C-x C-l
                    196: downcase-region
                    197: .It C-x C-o
                    198: delete-blank-lines
                    199: .It C-x C-q
                    200: toggle-read-only
                    201: .It C-x C-r
                    202: find-file-read-only
                    203: .It C-x C-s
                    204: save-buffer
                    205: .It C-x C-u
                    206: upcase-region
                    207: .It C-x C-v
                    208: find-alternate-file
                    209: .It C-x C-w
                    210: write-file
                    211: .It C-x C-x
                    212: exchange-point-and-mark
                    213: .It C-x (
                    214: start-kbd-macro
1.45      nicm      215: .It C-x \&)
1.37      kjell     216: end-kbd-macro
                    217: .It C-x 0
                    218: delete-window
                    219: .It C-x 1
                    220: delete-other-windows
                    221: .It C-x 2
                    222: split-window-vertically
                    223: .It C-x 4 C-f
                    224: find-file-other-window
                    225: .It C-x 4 C-g
                    226: keyboard-quit
                    227: .It C-x 4 b
                    228: switch-to-buffer-other-window
                    229: .It C-x 4 f
                    230: find-file-other-window
                    231: .It C-x =
                    232: what-cursor-position
                    233: .It C-x ^
                    234: enlarge-window
                    235: .It C-x `
                    236: next-error
                    237: .It C-x b
                    238: switch-to-buffer
                    239: .It C-x d
                    240: dired
                    241: .It C-x e
                    242: call-last-kbd-macro
                    243: .It C-x f
                    244: set-fill-column
                    245: .It C-x g
                    246: goto-line
1.59      lum       247: .It C-x h
                    248: mark-whole-buffer
1.37      kjell     249: .It C-x i
                    250: insert-file
                    251: .It C-x k
                    252: kill-buffer
                    253: .It C-x n
                    254: other-window
                    255: .It C-x o
                    256: other-window
                    257: .It C-x p
                    258: previous-window
                    259: .It C-x s
                    260: save-some-buffers
                    261: .It C-x u
                    262: undo
                    263: .It C-y
                    264: yank
                    265: .It C-z
                    266: suspend-emacs
                    267: .It M-C-v
                    268: scroll-other-window
                    269: .It M-SPC
                    270: just-one-space
1.56      lum       271: .It M-.
                    272: find-tag
                    273: .It M-*
                    274: pop-tag-mark
1.23      deraadt   275: .It M-%
1.37      kjell     276: query-replace
1.4       deraadt   277: .It M-<
1.37      kjell     278: beginning-of-buffer
1.4       deraadt   279: .It M->
1.37      kjell     280: end-of-buffer
                    281: .It M-\e
                    282: delete-horizontal-space
1.49      kjell     283: .It M-^
                    284: join-line
1.37      kjell     285: .It M-b
                    286: backward-word
                    287: .It M-c
                    288: capitalize-word
                    289: .It M-d
                    290: kill-word
                    291: .It M-f
                    292: forward-word
                    293: .It M-l
                    294: downcase-word
1.48      kjell     295: .It M-m
                    296: back-to-indentation
1.37      kjell     297: .It M-q
                    298: fill-paragraph
                    299: .It M-r
                    300: search-backward
                    301: .It M-s
                    302: search-forward
                    303: .It M-u
                    304: upcase-word
                    305: .It M-v
                    306: scroll-down
                    307: .It M-w
                    308: copy-region-as-kill
                    309: .It M-x
                    310: execute-extended-command
                    311: .It M-{
                    312: backward-paragraph
1.59      lum       313: .It M-|
                    314: shell-command-on-region
1.37      kjell     315: .It M-}
                    316: forward-paragraph
                    317: .It M-~
                    318: not-modified
                    319: .It M-DEL
                    320: backward-kill-word
                    321: .It C-_
                    322: undo
                    323: .It )
                    324: blink-and-insert
                    325: .It DEL
                    326: delete-backward-char
1.4       deraadt   327: .El
                    328: .Pp
1.37      kjell     329: For a complete description of
                    330: .Nm
                    331: commands, see
                    332: .Sx MG COMMANDS .
                    333: To see the active keybindings at any time, type
1.4       deraadt   334: .Dq M-x describe-bindings .
1.37      kjell     335: .Sh MG COMMANDS
1.33      kjell     336: Commands are invoked by
                    337: .Dq M-x ,
                    338: or by binding to a key.
                    339: Many commands take an optional numerical parameter,
                    340: .Va n .
                    341: This parameter is set either by
                    342: M-<n> (where
                    343: .Va n
                    344: is the numerical argument) before the command, or by
1.60      lum       345: one or more invocations of the universal argument, usually bound to C-u.
1.33      kjell     346: When invoked in this manner, the value of the numeric parameter to
                    347: be passed is displayed in the minibuffer before the M-x.
1.39      jmc       348: One common use of the parameter is in mode toggles (e.g.\&
1.37      kjell     349: make-backup-files).
                    350: If no parameter is supplied, the mode is toggled to its
                    351: alternate state.
                    352: If a positive parameter is supplied, the mode is forced to on.
                    353: Otherwise, it is forced to off.
                    354: .\"
                    355: .Bl -tag -width xxxxx
                    356: .It apropos
                    357: Help Apropos.
                    358: Prompt the user for a string, open the *help* buffer,
                    359: and list all
                    360: .Nm
                    361: commands that contain that string.
                    362: .It auto-execute
                    363: Register an auto-execute hook; that is, specify a filename pattern
                    364: (conforming to the shell's filename globbing rules) and an associated
                    365: function to execute when a file matching the specified pattern
                    366: is read into a buffer.
                    367: .It auto-fill-mode
                    368: Toggle auto-fill mode (sometimes called mail-mode),
                    369: where text inserted past the fill column is automatically wrapped
                    370: to a new line.
                    371: .It auto-indent-mode
1.39      jmc       372: Toggle indent mode, where indentation is preserved after a newline.
1.48      kjell     373: .It back-to-indentation
                    374: Move the dot to the first non-whitespace character on the current line.
1.62      lum       375: .It backup-to-home-directory
1.65      jmc       376: Save backup copies to a
                    377: .Pa ~/.mg.d
                    378: directory instead of working directory.
1.62      lum       379: Requires make-backup-files to be on.
1.37      kjell     380: .It backward-char
                    381: Move cursor backwards one character.
                    382: .It backward-kill-word
                    383: Kill text backwards by
                    384: .Va n
                    385: words.
                    386: .It backward-paragraph
                    387: Move cursor backwards
                    388: .Va n
                    389: paragraphs.
                    390: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
                    391: .It backward-word
                    392: Move cursor backwards by the specified number of words.
                    393: .It beginning-of-buffer
                    394: Move cursor to the top of the buffer.
                    395: .It beginning-of-line
                    396: Move cursor to the beginning of the line.
                    397: .It blink-and-insert
                    398: Self-insert a character, then search backwards and blink its
1.68      sobrado   399: matching delimiter.
                    400: For delimiters other than
1.37      kjell     401: parenthesis, brackets, and braces, the character itself
                    402: is used as its own match.
                    403: .It bsmap-mode
1.60      lum       404: Toggle bsmap mode, where DEL and C-h are swapped.
1.42      sobrado   405: .It c-mode
                    406: Toggle a KNF-compliant mode for editing C program files.
1.37      kjell     407: .It call-last-kbd-macro
                    408: Invoke the keyboard macro.
                    409: .It capitalize-word
                    410: Capitalize
                    411: .Va n
                    412: words; i.e. convert the first character of the word to
                    413: upper case, and subsequent letters to lower case.
                    414: .It cd
                    415: Change the global working directory.
                    416: See also global-wd-mode.
                    417: .It copy-region-as-kill
                    418: Copy all of the characters in the region to the kill buffer,
                    419: clearing the mark afterwards.
                    420: This is a bit like a kill-region followed by a yank.
                    421: .It count-matches
                    422: Count the number of lines matching the supplied regular expression.
                    423: .It count-non-matches
                    424: Count the number of lines not matching the supplied regular expression.
1.61      lum       425: .It cscope-find-this-symbol
                    426: List the matches for the given symbol.
                    427: .It cscope-find-global-definition
                    428: List global definitions for the given literal.
                    429: .It cscope-find-called-functions
                    430: List functions called from the given function.
                    431: .It cscope-find-functions-calling-this-function
                    432: List functions calling the given function.
                    433: .It cscope-find-this-text-string
                    434: List locations matching the given text string.
                    435: .It cscope-find-egrep-pattern
                    436: List locations matching the given extended regular expression pattern.
                    437: .It cscope-find-this-file
                    438: List filenames matching the given filename.
                    439: .It cscope-find-files-including-file
                    440: List files that #include the given filename.
                    441: .It cscope-next-symbol
                    442: Navigate to the next match.
                    443: .It cscope-prev-symbol
                    444: Navigate to the previous match.
                    445: .It cscope-next-file
1.68      sobrado   446: Navigate to the next file.
1.61      lum       447: .It cscope-prev-file
                    448: Navigate to the previous file.
                    449: .It cscope-create-list-of-files-to-index
                    450: Create cscope's List and Index in the given directory.
1.37      kjell     451: .It define-key
1.39      jmc       452: Prompts the user for a named keymap (mode),
1.40      sobrado   453: a key, and an
                    454: .Nm
                    455: command, then creates a keybinding in the appropriate
1.37      kjell     456: map.
                    457: .It delete-backward-char
                    458: Delete backwards
                    459: .Va n
                    460: characters.
                    461: Like delete-char, this actually does a kill if presented
                    462: with an argument.
                    463: .It delete-blank-lines
                    464: Delete blank lines around dot.
                    465: If dot is sitting on a blank line, this command
                    466: deletes all the blank lines above and below the current line.
                    467: Otherwise, it deletes all of the blank lines after the current line.
                    468: .It delete-char
                    469: Delete
                    470: .Va n
                    471: characters forward.
                    472: If any argument is present, it kills rather than deletes,
                    473: saving the result in the kill buffer.
                    474: .It delete-horizontal-space
                    475: Delete any whitespace around the dot.
                    476: .It delete-leading-space
                    477: Delete leading whitespace on the current line.
                    478: .It delete-trailing-space
                    479: Delete trailing whitespace on the current line.
                    480: .It delete-matching-lines
                    481: Delete all lines after dot that contain a string matching
                    482: the supplied regular expression.
                    483: .It delete-non-matching-lines
                    484: Delete all lines after dot that contain a string matching
                    485: the supplied regular expression.
                    486: .It delete-other-windows
                    487: Make the current window the only window visible on the screen.
                    488: .It delete-window
                    489: Delete current window.
                    490: .It describe-bindings
                    491: List all global and local keybindings, putting the result in
                    492: the *help* buffer.
                    493: .It describe-key-briefly
                    494: Read a key from the keyboard, and look it up in the keymap.
                    495: Display the name of the function currently bound to the key.
                    496: .It digit-argument
                    497: Process a numerical argument for keyboard-invoked functions.
                    498: .It downcase-region
                    499: Set all characters in the region to lower case.
                    500: .It downcase-word
                    501: Set characters to lower case, starting at the dot, and ending
                    502: .Va n
                    503: words away.
                    504: .It emacs-version
1.40      sobrado   505: Return an
                    506: .Nm
                    507: version string.
1.37      kjell     508: .It end-kbd-macro
                    509: Stop defining a keyboard macro.
                    510: .It end-of-buffer
                    511: Move cursor to the end of the buffer.
                    512: .It end-of-line
1.40      sobrado   513: Move cursor to the end of the line.
1.37      kjell     514: .It enlarge-window
                    515: Enlarge the current window by shrinking either the window above
                    516: or below it.
                    517: .It eval-current-buffer
1.40      sobrado   518: Evaluate the current buffer as a series of
                    519: .Nm
                    520: commands.
1.37      kjell     521: Useful for testing
                    522: .Nm
                    523: startup files.
                    524: .It eval-expression
                    525: Get one line from the user, and run it.
                    526: Useful for testing expressions in
                    527: .Nm
                    528: startup files.
                    529: .It exchange-point-and-mark
                    530: Swap the values of "dot" and "mark" in the current window.
                    531: Return an error if no mark is set.
                    532: .It execute-extended-command
                    533: Invoke an extended command; i.e. M-x.
                    534: Call the message line routine to read in the command name and apply
                    535: autocompletion to it.
                    536: When it comes back, look the name up in the symbol table and run the
                    537: command if it is found, passing arguments as necessary.
                    538: Print an error if there is anything wrong.
                    539: .It fill-paragraph
                    540: Justify a paragraph, wrapping text at the current fill column.
                    541: .It find-file
                    542: Select a file for editing.
1.54      lum       543: First check if the file can be found
                    544: in another buffer; if it is there, just switch to that buffer.
                    545: If the file cannot be found, create a new buffer, read in the
1.37      kjell     546: file from disk, and switch to the new buffer.
                    547: .It find-file-read-only
                    548: Same as find-file, except the new buffer is set to read-only.
                    549: .It find-alternate-file
                    550: Replace the current file with an alternate one.
                    551: Semantics for finding the replacement file are the same as
1.39      jmc       552: find-file, except the current buffer is killed before the switch.
1.37      kjell     553: If the kill fails, or is aborted, revert to the original file.
                    554: .It find-file-other-window
                    555: Opens the specified file in a second buffer.
                    556: Splits the current window if necessary.
1.56      lum       557: .It find-tag
                    558: Jump to definition of tag at dot.
1.37      kjell     559: .It forward-char
                    560: Move cursor forwards (or backwards, if
                    561: .Va n
                    562: is negative)
                    563: .Va n
                    564: characters.
                    565: Returns an error if the end of buffer is reached.
                    566: .It forward-paragraph
                    567: Move forward
                    568: .Va n
                    569: paragraphs.
1.39      jmc       570: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
1.37      kjell     571: .It forward-word
                    572: Move the cursor forward by the specified number of words.
                    573: .It global-set-key
                    574: Bind a key in the global (fundamental) key map.
                    575: .It global-unset-key
1.40      sobrado   576: Unbind a key from the global (fundamental) key map; i.e. set it to 'rescan'.
1.37      kjell     577: .It global-wd-mode
                    578: Toggle global working-directory mode.
                    579: When enabled,
                    580: .Nm
                    581: defaults to opening files (and executing commands like compile and grep)
1.39      jmc       582: relative to the global working directory.
1.37      kjell     583: When disabled, a working directory is set for each buffer.
                    584: .It goto-line
                    585: Go to a specific line.
                    586: If an argument is present, then
                    587: it is the line number, else prompt for a line number to use.
                    588: .It help-help
1.39      jmc       589: Prompts for one of (a)propos, (b)indings, des(c)ribe key briefly.
1.37      kjell     590: .It insert
                    591: Insert a string, mainly for use from macros.
                    592: .It insert-buffer
1.40      sobrado   593: Insert the contents of another buffer at dot.
1.37      kjell     594: .It insert-file
                    595: Insert a file into the current buffer at dot.
                    596: .It insert-with-wrap
                    597: Insert the bound character with word wrap.
                    598: Check to see if we're past the fill column, and if so,
                    599: justify this line.
                    600: .It isearch-backward
                    601: Use incremental searching, initially in the reverse direction.
                    602: isearch ignores any explicit arguments.
1.39      jmc       603: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     604: search-backward is invoked instead.
                    605: .It isearch-forward
                    606: Use incremental searching, initially in the forward direction.
                    607: isearch ignores any explicit arguments.
1.39      jmc       608: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     609: search-forward is invoked instead.
1.49      kjell     610: .It join-line
1.50      jmc       611: Join the current line to the previous.
                    612: If called with an argument,
1.49      kjell     613: join the next line to the current one.
1.37      kjell     614: .It just-one-space
                    615: Delete any whitespace around dot, then insert a space.
                    616: .It keyboard-quit
                    617: Abort the current action.
                    618: .It kill-buffer
                    619: Dispose of a buffer, by name.
1.43      kjell     620: If the buffer name does not start and end with an asterisk,
                    621: prompt the user if the buffer
1.37      kjell     622: has been changed.
                    623: .It kill-line
                    624: Kill line.
                    625: If called without an argument, it kills from dot to the end
                    626: of the line, unless it is at the end of the line, when it kills the
                    627: newline.
                    628: If called with an argument of 0, it kills from the start of the
                    629: line to dot.
                    630: If called with a positive argument, it kills from dot
                    631: forward over that number of newlines.
                    632: If called with a negative argument
                    633: it kills any text before dot on the current line, then it kills back
                    634: abs(n) lines.
                    635: .It kill-paragraph
                    636: Delete
                    637: .Va n
                    638: paragraphs starting with the current one.
                    639: .It kill-region
1.39      jmc       640: Kill the currently defined region.
1.37      kjell     641: .It kill-word
                    642: Delete forward
                    643: .Va n
                    644: words.
1.67      lum       645: .It leave-tmpdir-backups
                    646: Modifies the behaviour of backup-to-home-directory.
                    647: Backup files that would normally reside in the system
                    648: .Ev TMPDIR
                    649: are left there and not moved to the
                    650: .Pa ~/.mg.d
                    651: directory.
1.37      kjell     652: .It line-number-mode
1.71    ! florian   653: Toggle whether the line number is displayed in the modeline.
1.37      kjell     654: .It list-buffers
                    655: Display the list of available buffers.
                    656: .It load
                    657: Prompt the user for a filename, and then execute commands
                    658: from that file.
                    659: .It local-set-key
                    660: Bind a key mapping in the local (topmost) mode.
                    661: .It local-unset-key
                    662: Unbind a key mapping in the local (topmost) mode.
                    663: .It make-backup-files
                    664: Toggle generation of backup files.
1.59      lum       665: .It mark-whole-buffer
                    666: Marks whole buffer as a region by putting dot at the beginning and mark
                    667: at the end of buffer.
1.37      kjell     668: .It meta-key-mode
                    669: When disabled, the meta key can be used to insert extended-ascii (8-bit)
                    670: characters.
                    671: When enabled, the meta key acts as usual.
                    672: .It negative-argument
1.39      jmc       673: Process a negative argument for keyboard-invoked functions.
1.37      kjell     674: .It newline
                    675: Insert a newline into the current buffer.
                    676: .It newline-and-indent
                    677: Insert a newline, then enough tabs and spaces to duplicate the indentation
                    678: of the previous line.
                    679: Assumes tabs are every eight characters.
                    680: .It next-line
                    681: Move forward
                    682: .Va n
                    683: lines.
                    684: .It no-tab-mode
                    685: Toggle notab mode.
                    686: In this mode, spaces are inserted rather than tabs.
                    687: .It not-modified
                    688: Turn off the modified flag in the current buffer.
                    689: .It open-line
                    690: Open up some blank space.
                    691: Essentially, insert
                    692: .Va n
                    693: newlines, then back up over them.
                    694: .It other-window
                    695: The command to make the next (down the screen) window the current
                    696: window.
                    697: There are no real errors, although the command does nothing if
                    698: there is only 1 window on the screen.
                    699: .It overwrite-mode
1.39      jmc       700: Toggle overwrite mode, where typing in a buffer overwrites
1.37      kjell     701: existing characters rather than inserting them.
                    702: .It prefix-region
                    703: Inserts a prefix string before each line of a region.
                    704: The prefix string is settable by using 'set-prefix-string'.
                    705: .It previous-line
                    706: Move backwards
                    707: .Va n
                    708: lines.
                    709: .It previous-window
                    710: This command makes the previous (up the screen) window the
                    711: current window.
                    712: There are no errors, although the command does not do
                    713: a lot if there is only 1 window.
1.56      lum       714: .It pop-tag-mark
                    715: Return to position where find-tag was previously invoked.
1.37      kjell     716: .It push-shell
1.40      sobrado   717: Suspend
                    718: .Nm
                    719: and switch to alternate screen, if available.
1.37      kjell     720: .It pwd
                    721: Display current (global) working directory in the status area.
                    722: .It query-replace
                    723: Query Replace.
                    724: Search and replace strings selectively, prompting after each match.
                    725: .It replace-string
                    726: Replace string globally without individual prompting.
                    727: .It query-replace-regexp
                    728: Replace strings selectively.
                    729: Does a search and replace operation using regular
                    730: expressions for both patterns.
                    731: .It quoted-insert
                    732: Insert the next character verbatim into the current buffer; i.e. ignore
                    733: any function bound to that key.
                    734: .It re-search-again
                    735: Perform a regular expression search again, using the same search
                    736: string and direction as the last search command.
                    737: .It re-search-backward
                    738: Search backwards using a regular expression.
                    739: Get a search string from the user, and search, starting at dot
                    740: and proceeding toward the front of the buffer.
1.39      jmc       741: If found, dot is left
1.37      kjell     742: pointing at the first character of the pattern [the last character that
                    743: was matched].
                    744: .It re-search-forward
                    745: Search forward using a regular expression.
                    746: Get a search string from the user and search for it starting at dot.
                    747: If found, move dot to just after the matched characters.
                    748: display does all
                    749: the hard stuff.
                    750: If not found, it just prints a message.
                    751: .It recenter
                    752: Reposition dot in the current window.
1.39      jmc       753: By default, the dot is centered.
1.37      kjell     754: If given a positive argument (n), the display is repositioned to line
                    755: n.
                    756: If
                    757: .Va n
1.40      sobrado   758: is negative, it is that line from the bottom.
1.37      kjell     759: .It redraw-display
                    760: Refresh the display.
                    761: Recomputes all window sizes in case something has changed.
1.69      jasper    762: .It revert-buffer
                    763: Revert the current buffer to the latest file on disk.
1.37      kjell     764: .It save-buffer
                    765: Save the contents of the current buffer if it has been changed,
                    766: optionally creating a backup copy.
                    767: .It save-buffers-kill-emacs
1.40      sobrado   768: Offer to save modified buffers and quit
                    769: .Nm .
1.37      kjell     770: .It save-some-buffers
                    771: Look through the list of buffers, offering to save any buffer that
                    772: has been changed.
                    773: Buffers that are not associated with files (such
                    774: as *scratch*, *grep*, *compile*) are ignored.
                    775: .It scroll-down
                    776: Scroll backwards
                    777: .Va n
                    778: pages.
                    779: A two-line overlap between pages is
                    780: assumed.
                    781: If given a repeat argument, scrolls back lines, not pages.
                    782: .It scroll-one-line-down
                    783: Scroll the display down
                    784: .Va n
                    785: lines without changing the cursor position.
                    786: .It scroll-one-line-up
                    787: Scroll the display
                    788: .Va n
1.40      sobrado   789: lines up without moving the cursor position.
1.37      kjell     790: .It scroll-other-window
                    791: Scroll the next window in the window list window forward
                    792: .Va n
                    793: pages.
                    794: .It scroll-up
                    795: Scroll forward one page.
                    796: A two-line overlap between pages is
                    797: assumed.
                    798: If given a repeat argument, scrolls back lines, not pages.
                    799: .It search-again
                    800: Search again, using the same search string and direction as the last
                    801: search command.
                    802: .It search-backward
                    803: Reverse search.
                    804: Get a search string from the user, and search, starting
                    805: at dot and proceeding toward the front of the buffer.
                    806: If found, dot is
                    807: left pointing at the first character of the pattern (the last character
                    808: that was matched).
                    809: .It search-forward
                    810: Search forward.
                    811: Get a search string from the user, and search for it
                    812: starting at dot.
                    813: If found, dot gets moved to just after the matched
                    814: characters, if not found, print a message.
                    815: .It self-insert-command
                    816: Insert a character.
                    817: .It set-case-fold-search
1.58      lum       818: Set case-fold searching, causing case not to matter
1.37      kjell     819: in regular expression searches.
                    820: This is the default.
                    821: .It set-default-mode
                    822: Append the supplied mode to the list of default modes
                    823: used by subsequent buffer creation.
                    824: Built in modes include: fill, indent, overwrite, and notab.
                    825: .It set-fill-column
                    826: Prompt the user for a fill column.
                    827: Used by auto-fill-mode.
                    828: .It set-mark-command
1.40      sobrado   829: Sets the mark in the current window to the current dot location.
1.37      kjell     830: .It set-prefix-string
                    831: Sets the prefix string to be used by the 'prefix-region' command.
1.59      lum       832: .It shell-command-on-region
                    833: Provide the text in region to the shell command as input.
1.37      kjell     834: .It shrink-window
                    835: Shrink current window by one line.
                    836: The window immediately below is expanded to pick up the slack.
                    837: If only one window is present, this command has no effect.
                    838: .It space-to-tabstop
                    839: Insert enough spaces to reach the next tab-stop position.
                    840: By default, tab-stops occur every 8 characters.
                    841: .It split-window-vertically
                    842: Split the current window.
                    843: A window smaller than 3 lines cannot be split.
                    844: .It start-kbd-macro
                    845: Start defining a keyboard macro.
                    846: Macro definition is ended by invoking end-kbd-macro.
                    847: .It suspend-emacs
1.40      sobrado   848: Suspend
                    849: .Nm
                    850: and switch back to alternate screen, if in use.
1.37      kjell     851: .It switch-to-buffer
                    852: Prompt and switch to a new buffer in the current window.
                    853: .It switch-to-buffer-other-window
                    854: Switch to buffer in another window.
                    855: .It toggle-read-only
                    856: Toggle the read-only flag on the current buffer.
                    857: .It transpose-chars
                    858: Transpose the two characters on either side of dot.
1.39      jmc       859: If dot is at the end of the line, transpose the two characters before it.
1.37      kjell     860: Return with an error if dot is at the beginning of line;
1.39      jmc       861: it seems to be a bit pointless to
1.37      kjell     862: make this work.
                    863: .It undo
                    864: Undo the most recent action.
                    865: If invoked again without an intervening command,
                    866: move the undo pointer to the previous action and undo it.
1.41      kjell     867: .It undo-boundary
                    868: Add an undo boundary.
                    869: This is not usually done interactively.
                    870: .It undo-boundary-toggle
                    871: Toggle whether undo boundaries are generated.
                    872: Undo boundaries are often disabled before operations that should
                    873: be considered atomically undoable.
                    874: .It undo-enable
                    875: Toggle whether undo information is kept.
1.37      kjell     876: .It undo-list
                    877: Show the undo records for the current buffer in a new buffer.
                    878: .It universal-argument
                    879: Repeat the next command 4 times.
                    880: Usually bound to C-u.
1.39      jmc       881: This command may be stacked; e.g.\&
1.37      kjell     882: C-u C-u C-f moves the cursor forward 16 characters.
                    883: .It upcase-region
                    884: Upper case region.
                    885: Change all of the lower case characters in the region to
1.40      sobrado   886: upper case.
1.37      kjell     887: .It upcase-word
                    888: Move the cursor forward by the specified number of words.
1.54      lum       889: As it moves, convert any characters to upper case.
1.56      lum       890: .It visit-tags-table
                    891: Record name of the tags file to be used for subsequent find-tag.
1.37      kjell     892: .It what-cursor-position
                    893: Display a bunch of useful information about the current location of
                    894: dot.
                    895: The character under the cursor (in octal), the current line, row,
                    896: and column, and approximate position of the cursor in the file (as a
                    897: percentage) is displayed.
                    898: The column position assumes an infinite
                    899: position display; it does not truncate just because the screen does.
                    900: .It write-file
                    901: Ask for a file name and write the contents of the current buffer to
                    902: that file.
                    903: Update the remembered file name and clear the buffer
                    904: changed flag.
                    905: .It yank
                    906: Yank text from kill-buffer.
1.40      sobrado   907: Unlike emacs, the
                    908: .Nm
                    909: kill buffer consists only
1.37      kjell     910: of the most recent kill.
                    911: It is not a ring.
                    912: .El
1.33      kjell     913: .Sh CONFIGURATION FILES
1.7       aaron     914: There are two configuration files,
1.65      jmc       915: .Pa .mg
1.1       deraadt   916: and
1.3       aaron     917: .Pa .mg-TERM .
                    918: Here,
                    919: .Ev TERM
1.65      jmc       920: represents the name of the terminal type; e.g. if the terminal type
1.3       aaron     921: is set to
                    922: .Dq vt100 ,
1.2       deraadt   923: .Nm
1.1       deraadt   924: will use
1.3       aaron     925: .Pa .mg-vt100
1.6       aaron     926: as a startup file.
                    927: The terminal type startup file is used first.
1.33      kjell     928: .Pp
1.28      jmc       929: The startup file format is a list of commands, one per line, as used for
1.33      kjell     930: interactive evaluation.
                    931: Strings that are normally entered by the user at any subsequent prompts
                    932: may be specified after the command name; e.g.:
1.28      jmc       933: .Bd -literal -offset indent
1.37      kjell     934: global-set-key ")" self-insert-command
1.46      jmc       935: global-set-key "\e^x\e^f" find-file
                    936: global-set-key "\ee[Z" backward-char
1.37      kjell     937: set-default-mode fill
1.28      jmc       938: set-fill-column 72
1.37      kjell     939: auto-execute *.c c-mode
1.28      jmc       940: .Ed
1.3       aaron     941: .Sh FILES
1.55      lum       942: .Bl -tag -width /usr/share/doc/mg/tutorial -compact
1.3       aaron     943: .It Pa ~/.mg
                    944: normal startup file
                    945: .It Pa ~/.mg-TERM
                    946: terminal-specific startup file
1.63      lum       947: .It Pa ~/.mg.d
                    948: alternative backup file location
1.52      lum       949: .It Pa /usr/share/doc/mg/tutorial
1.51      lum       950: concise tutorial
1.3       aaron     951: .El
                    952: .Sh SEE ALSO
1.56      lum       953: .Xr ctags 1 ,
1.2       deraadt   954: .Xr vi 1
1.29      reyk      955: .Sh CAVEATS
1.37      kjell     956: Since it is written completely in C, there is currently no
1.54      lum       957: language in which extensions can be written;
                    958: however, keys can be rebound and certain parameters can be changed
1.38      kjell     959: in startup files.
1.33      kjell     960: .Pp
                    961: In order to use 8-bit characters (such as German umlauts), the Meta key
                    962: needs to be disabled via the
                    963: .Dq meta-key-mode
                    964: command.