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

1.92    ! lum         1: .\"    $OpenBSD: mg.1,v 1.91 2015/09/09 19:03:13 lum Exp $
1.34      kjell       2: .\" This file is in the public domain.
1.9       niklas      3: .\"
1.92    ! lum         4: .Dd $Mdocdate: September 9 2015 $
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
1.90      jmc        89: make-backup-files command.
1.64      lum        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.76      lum       271: .It M-!
                    272: shell-command
1.56      lum       273: .It M-.
                    274: find-tag
                    275: .It M-*
                    276: pop-tag-mark
1.23      deraadt   277: .It M-%
1.37      kjell     278: query-replace
1.4       deraadt   279: .It M-<
1.37      kjell     280: beginning-of-buffer
1.4       deraadt   281: .It M->
1.37      kjell     282: end-of-buffer
                    283: .It M-\e
                    284: delete-horizontal-space
1.49      kjell     285: .It M-^
                    286: join-line
1.37      kjell     287: .It M-b
                    288: backward-word
                    289: .It M-c
                    290: capitalize-word
                    291: .It M-d
                    292: kill-word
                    293: .It M-f
                    294: forward-word
1.92    ! lum       295: .It M-h
        !           296: mark-paragraph
1.37      kjell     297: .It M-l
                    298: downcase-word
1.48      kjell     299: .It M-m
                    300: back-to-indentation
1.37      kjell     301: .It M-q
                    302: fill-paragraph
                    303: .It M-r
                    304: search-backward
                    305: .It M-s
                    306: search-forward
                    307: .It M-u
                    308: upcase-word
                    309: .It M-v
                    310: scroll-down
                    311: .It M-w
                    312: copy-region-as-kill
                    313: .It M-x
                    314: execute-extended-command
                    315: .It M-{
                    316: backward-paragraph
1.59      lum       317: .It M-|
                    318: shell-command-on-region
1.37      kjell     319: .It M-}
                    320: forward-paragraph
                    321: .It M-~
                    322: not-modified
                    323: .It M-DEL
                    324: backward-kill-word
                    325: .It C-_
                    326: undo
                    327: .It )
                    328: blink-and-insert
                    329: .It DEL
                    330: delete-backward-char
1.4       deraadt   331: .El
                    332: .Pp
1.37      kjell     333: For a complete description of
                    334: .Nm
                    335: commands, see
                    336: .Sx MG COMMANDS .
                    337: To see the active keybindings at any time, type
1.4       deraadt   338: .Dq M-x describe-bindings .
1.37      kjell     339: .Sh MG COMMANDS
1.33      kjell     340: Commands are invoked by
                    341: .Dq M-x ,
                    342: or by binding to a key.
                    343: Many commands take an optional numerical parameter,
                    344: .Va n .
                    345: This parameter is set either by
                    346: M-<n> (where
                    347: .Va n
                    348: is the numerical argument) before the command, or by
1.60      lum       349: one or more invocations of the universal argument, usually bound to C-u.
1.33      kjell     350: When invoked in this manner, the value of the numeric parameter to
                    351: be passed is displayed in the minibuffer before the M-x.
1.39      jmc       352: One common use of the parameter is in mode toggles (e.g.\&
1.37      kjell     353: make-backup-files).
                    354: If no parameter is supplied, the mode is toggled to its
                    355: alternate state.
                    356: If a positive parameter is supplied, the mode is forced to on.
                    357: Otherwise, it is forced to off.
                    358: .\"
                    359: .Bl -tag -width xxxxx
                    360: .It apropos
                    361: Help Apropos.
                    362: Prompt the user for a string, open the *help* buffer,
                    363: and list all
                    364: .Nm
                    365: commands that contain that string.
1.79      lum       366: .It audible-bell
                    367: Toggle the audible system bell.
1.37      kjell     368: .It auto-execute
                    369: Register an auto-execute hook; that is, specify a filename pattern
                    370: (conforming to the shell's filename globbing rules) and an associated
                    371: function to execute when a file matching the specified pattern
                    372: is read into a buffer.
                    373: .It auto-fill-mode
                    374: Toggle auto-fill mode (sometimes called mail-mode),
                    375: where text inserted past the fill column is automatically wrapped
                    376: to a new line.
                    377: .It auto-indent-mode
1.39      jmc       378: Toggle indent mode, where indentation is preserved after a newline.
1.48      kjell     379: .It back-to-indentation
                    380: Move the dot to the first non-whitespace character on the current line.
1.62      lum       381: .It backup-to-home-directory
1.65      jmc       382: Save backup copies to a
                    383: .Pa ~/.mg.d
                    384: directory instead of working directory.
1.62      lum       385: Requires make-backup-files to be on.
1.37      kjell     386: .It backward-char
                    387: Move cursor backwards one character.
                    388: .It backward-kill-word
                    389: Kill text backwards by
                    390: .Va n
                    391: words.
                    392: .It backward-paragraph
                    393: Move cursor backwards
                    394: .Va n
                    395: paragraphs.
                    396: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
                    397: .It backward-word
                    398: Move cursor backwards by the specified number of words.
                    399: .It beginning-of-buffer
                    400: Move cursor to the top of the buffer.
                    401: .It beginning-of-line
                    402: Move cursor to the beginning of the line.
                    403: .It blink-and-insert
                    404: Self-insert a character, then search backwards and blink its
1.68      sobrado   405: matching delimiter.
                    406: For delimiters other than
1.37      kjell     407: parenthesis, brackets, and braces, the character itself
                    408: is used as its own match.
                    409: .It bsmap-mode
1.60      lum       410: Toggle bsmap mode, where DEL and C-h are swapped.
1.42      sobrado   411: .It c-mode
                    412: Toggle a KNF-compliant mode for editing C program files.
1.37      kjell     413: .It call-last-kbd-macro
                    414: Invoke the keyboard macro.
                    415: .It capitalize-word
                    416: Capitalize
                    417: .Va n
                    418: words; i.e. convert the first character of the word to
                    419: upper case, and subsequent letters to lower case.
                    420: .It cd
                    421: Change the global working directory.
                    422: See also global-wd-mode.
1.73      florian   423: .It column-number-mode
                    424: Toggle whether the column number is displayed in the modeline.
1.37      kjell     425: .It copy-region-as-kill
                    426: Copy all of the characters in the region to the kill buffer,
                    427: clearing the mark afterwards.
                    428: This is a bit like a kill-region followed by a yank.
                    429: .It count-matches
                    430: Count the number of lines matching the supplied regular expression.
                    431: .It count-non-matches
                    432: Count the number of lines not matching the supplied regular expression.
1.61      lum       433: .It cscope-find-this-symbol
                    434: List the matches for the given symbol.
                    435: .It cscope-find-global-definition
                    436: List global definitions for the given literal.
                    437: .It cscope-find-called-functions
                    438: List functions called from the given function.
                    439: .It cscope-find-functions-calling-this-function
                    440: List functions calling the given function.
                    441: .It cscope-find-this-text-string
                    442: List locations matching the given text string.
                    443: .It cscope-find-egrep-pattern
                    444: List locations matching the given extended regular expression pattern.
                    445: .It cscope-find-this-file
                    446: List filenames matching the given filename.
                    447: .It cscope-find-files-including-file
                    448: List files that #include the given filename.
                    449: .It cscope-next-symbol
                    450: Navigate to the next match.
                    451: .It cscope-prev-symbol
                    452: Navigate to the previous match.
                    453: .It cscope-next-file
1.68      sobrado   454: Navigate to the next file.
1.61      lum       455: .It cscope-prev-file
                    456: Navigate to the previous file.
                    457: .It cscope-create-list-of-files-to-index
                    458: Create cscope's List and Index in the given directory.
1.37      kjell     459: .It define-key
1.39      jmc       460: Prompts the user for a named keymap (mode),
1.40      sobrado   461: a key, and an
                    462: .Nm
                    463: command, then creates a keybinding in the appropriate
1.37      kjell     464: map.
                    465: .It delete-backward-char
                    466: Delete backwards
                    467: .Va n
                    468: characters.
                    469: Like delete-char, this actually does a kill if presented
                    470: with an argument.
                    471: .It delete-blank-lines
                    472: Delete blank lines around dot.
                    473: If dot is sitting on a blank line, this command
                    474: deletes all the blank lines above and below the current line.
                    475: Otherwise, it deletes all of the blank lines after the current line.
                    476: .It delete-char
                    477: Delete
                    478: .Va n
                    479: characters forward.
                    480: If any argument is present, it kills rather than deletes,
                    481: saving the result in the kill buffer.
                    482: .It delete-horizontal-space
                    483: Delete any whitespace around the dot.
                    484: .It delete-leading-space
                    485: Delete leading whitespace on the current line.
                    486: .It delete-trailing-space
                    487: Delete trailing whitespace on the current line.
                    488: .It delete-matching-lines
                    489: Delete all lines after dot that contain a string matching
                    490: the supplied regular expression.
                    491: .It delete-non-matching-lines
                    492: Delete all lines after dot that contain a string matching
                    493: the supplied regular expression.
                    494: .It delete-other-windows
                    495: Make the current window the only window visible on the screen.
                    496: .It delete-window
                    497: Delete current window.
                    498: .It describe-bindings
                    499: List all global and local keybindings, putting the result in
                    500: the *help* buffer.
                    501: .It describe-key-briefly
                    502: Read a key from the keyboard, and look it up in the keymap.
                    503: Display the name of the function currently bound to the key.
1.74      florian   504: .It diff-buffer-with-file
                    505: View the differences between buffer and its associated file.
1.37      kjell     506: .It digit-argument
                    507: Process a numerical argument for keyboard-invoked functions.
                    508: .It downcase-region
                    509: Set all characters in the region to lower case.
                    510: .It downcase-word
                    511: Set characters to lower case, starting at the dot, and ending
                    512: .Va n
                    513: words away.
                    514: .It emacs-version
1.40      sobrado   515: Return an
                    516: .Nm
                    517: version string.
1.37      kjell     518: .It end-kbd-macro
                    519: Stop defining a keyboard macro.
                    520: .It end-of-buffer
                    521: Move cursor to the end of the buffer.
                    522: .It end-of-line
1.40      sobrado   523: Move cursor to the end of the line.
1.37      kjell     524: .It enlarge-window
                    525: Enlarge the current window by shrinking either the window above
                    526: or below it.
                    527: .It eval-current-buffer
1.40      sobrado   528: Evaluate the current buffer as a series of
                    529: .Nm
                    530: commands.
1.37      kjell     531: Useful for testing
                    532: .Nm
                    533: startup files.
                    534: .It eval-expression
                    535: Get one line from the user, and run it.
                    536: Useful for testing expressions in
                    537: .Nm
                    538: startup files.
                    539: .It exchange-point-and-mark
                    540: Swap the values of "dot" and "mark" in the current window.
                    541: Return an error if no mark is set.
                    542: .It execute-extended-command
                    543: Invoke an extended command; i.e. M-x.
                    544: Call the message line routine to read in the command name and apply
                    545: autocompletion to it.
                    546: When it comes back, look the name up in the symbol table and run the
                    547: command if it is found, passing arguments as necessary.
                    548: Print an error if there is anything wrong.
                    549: .It fill-paragraph
                    550: Justify a paragraph, wrapping text at the current fill column.
                    551: .It find-file
                    552: Select a file for editing.
1.54      lum       553: First check if the file can be found
                    554: in another buffer; if it is there, just switch to that buffer.
                    555: If the file cannot be found, create a new buffer, read in the
1.37      kjell     556: file from disk, and switch to the new buffer.
                    557: .It find-file-read-only
                    558: Same as find-file, except the new buffer is set to read-only.
                    559: .It find-alternate-file
                    560: Replace the current file with an alternate one.
                    561: Semantics for finding the replacement file are the same as
1.39      jmc       562: find-file, except the current buffer is killed before the switch.
1.37      kjell     563: If the kill fails, or is aborted, revert to the original file.
                    564: .It find-file-other-window
                    565: Opens the specified file in a second buffer.
                    566: Splits the current window if necessary.
1.56      lum       567: .It find-tag
                    568: Jump to definition of tag at dot.
1.37      kjell     569: .It forward-char
                    570: Move cursor forwards (or backwards, if
                    571: .Va n
                    572: is negative)
                    573: .Va n
                    574: characters.
                    575: Returns an error if the end of buffer is reached.
                    576: .It forward-paragraph
                    577: Move forward
                    578: .Va n
                    579: paragraphs.
1.39      jmc       580: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
1.37      kjell     581: .It forward-word
                    582: Move the cursor forward by the specified number of words.
                    583: .It global-set-key
                    584: Bind a key in the global (fundamental) key map.
                    585: .It global-unset-key
1.40      sobrado   586: Unbind a key from the global (fundamental) key map; i.e. set it to 'rescan'.
1.37      kjell     587: .It global-wd-mode
                    588: Toggle global working-directory mode.
                    589: When enabled,
                    590: .Nm
                    591: defaults to opening files (and executing commands like compile and grep)
1.39      jmc       592: relative to the global working directory.
1.37      kjell     593: When disabled, a working directory is set for each buffer.
                    594: .It goto-line
                    595: Go to a specific line.
                    596: If an argument is present, then
                    597: it is the line number, else prompt for a line number to use.
                    598: .It help-help
1.39      jmc       599: Prompts for one of (a)propos, (b)indings, des(c)ribe key briefly.
1.37      kjell     600: .It insert
                    601: Insert a string, mainly for use from macros.
                    602: .It insert-buffer
1.40      sobrado   603: Insert the contents of another buffer at dot.
1.37      kjell     604: .It insert-file
                    605: Insert a file into the current buffer at dot.
                    606: .It insert-with-wrap
                    607: Insert the bound character with word wrap.
                    608: Check to see if we're past the fill column, and if so,
                    609: justify this line.
                    610: .It isearch-backward
                    611: Use incremental searching, initially in the reverse direction.
                    612: isearch ignores any explicit arguments.
1.39      jmc       613: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     614: search-backward is invoked instead.
                    615: .It isearch-forward
                    616: Use incremental searching, initially in the forward direction.
                    617: isearch ignores any explicit arguments.
1.39      jmc       618: If invoked during macro definition or evaluation, the non-incremental
1.37      kjell     619: search-forward is invoked instead.
1.49      kjell     620: .It join-line
1.50      jmc       621: Join the current line to the previous.
                    622: If called with an argument,
1.49      kjell     623: join the next line to the current one.
1.37      kjell     624: .It just-one-space
                    625: Delete any whitespace around dot, then insert a space.
                    626: .It keyboard-quit
                    627: Abort the current action.
                    628: .It kill-buffer
                    629: Dispose of a buffer, by name.
1.43      kjell     630: If the buffer name does not start and end with an asterisk,
                    631: prompt the user if the buffer
1.37      kjell     632: has been changed.
                    633: .It kill-line
                    634: Kill line.
                    635: If called without an argument, it kills from dot to the end
                    636: of the line, unless it is at the end of the line, when it kills the
                    637: newline.
                    638: If called with an argument of 0, it kills from the start of the
                    639: line to dot.
                    640: If called with a positive argument, it kills from dot
                    641: forward over that number of newlines.
                    642: If called with a negative argument
                    643: it kills any text before dot on the current line, then it kills back
                    644: abs(n) lines.
                    645: .It kill-paragraph
                    646: Delete
                    647: .Va n
                    648: paragraphs starting with the current one.
                    649: .It kill-region
1.39      jmc       650: Kill the currently defined region.
1.37      kjell     651: .It kill-word
                    652: Delete forward
                    653: .Va n
                    654: words.
1.67      lum       655: .It leave-tmpdir-backups
                    656: Modifies the behaviour of backup-to-home-directory.
                    657: Backup files that would normally reside in the system
                    658: .Ev TMPDIR
                    659: are left there and not moved to the
                    660: .Pa ~/.mg.d
                    661: directory.
1.37      kjell     662: .It line-number-mode
1.71      florian   663: Toggle whether the line number is displayed in the modeline.
1.37      kjell     664: .It list-buffers
                    665: Display the list of available buffers.
                    666: .It load
                    667: Prompt the user for a filename, and then execute commands
                    668: from that file.
                    669: .It local-set-key
                    670: Bind a key mapping in the local (topmost) mode.
                    671: .It local-unset-key
                    672: Unbind a key mapping in the local (topmost) mode.
                    673: .It make-backup-files
                    674: Toggle generation of backup files.
1.72      jasper    675: .It make-directory
                    676: Prompt the user for a path or directory name which is then created.
1.92    ! lum       677: .It mark-paragraph
        !           678: Mark n paragraphs.
1.59      lum       679: .It mark-whole-buffer
                    680: Marks whole buffer as a region by putting dot at the beginning and mark
                    681: at the end of buffer.
1.37      kjell     682: .It meta-key-mode
                    683: When disabled, the meta key can be used to insert extended-ascii (8-bit)
                    684: characters.
                    685: When enabled, the meta key acts as usual.
                    686: .It negative-argument
1.39      jmc       687: Process a negative argument for keyboard-invoked functions.
1.37      kjell     688: .It newline
                    689: Insert a newline into the current buffer.
                    690: .It newline-and-indent
                    691: Insert a newline, then enough tabs and spaces to duplicate the indentation
                    692: of the previous line.
                    693: Assumes tabs are every eight characters.
                    694: .It next-line
                    695: Move forward
                    696: .Va n
                    697: lines.
1.89      jmc       698: .\" .It no-tab-mode
                    699: .\" Toggle notab mode.
                    700: .\" In this mode, spaces are inserted rather than tabs.
1.37      kjell     701: .It not-modified
                    702: Turn off the modified flag in the current buffer.
                    703: .It open-line
                    704: Open up some blank space.
                    705: Essentially, insert
                    706: .Va n
                    707: newlines, then back up over them.
                    708: .It other-window
                    709: The command to make the next (down the screen) window the current
                    710: window.
                    711: There are no real errors, although the command does nothing if
                    712: there is only 1 window on the screen.
                    713: .It overwrite-mode
1.39      jmc       714: Toggle overwrite mode, where typing in a buffer overwrites
1.37      kjell     715: existing characters rather than inserting them.
                    716: .It prefix-region
                    717: Inserts a prefix string before each line of a region.
                    718: The prefix string is settable by using 'set-prefix-string'.
                    719: .It previous-line
                    720: Move backwards
                    721: .Va n
                    722: lines.
                    723: .It previous-window
                    724: This command makes the previous (up the screen) window the
                    725: current window.
                    726: There are no errors, although the command does not do
                    727: a lot if there is only 1 window.
1.56      lum       728: .It pop-tag-mark
                    729: Return to position where find-tag was previously invoked.
1.37      kjell     730: .It push-shell
1.40      sobrado   731: Suspend
                    732: .Nm
                    733: and switch to alternate screen, if available.
1.37      kjell     734: .It pwd
                    735: Display current (global) working directory in the status area.
                    736: .It query-replace
                    737: Query Replace.
                    738: Search and replace strings selectively, prompting after each match.
                    739: .It replace-string
                    740: Replace string globally without individual prompting.
                    741: .It query-replace-regexp
                    742: Replace strings selectively.
                    743: Does a search and replace operation using regular
                    744: expressions for both patterns.
                    745: .It quoted-insert
                    746: Insert the next character verbatim into the current buffer; i.e. ignore
                    747: any function bound to that key.
                    748: .It re-search-again
                    749: Perform a regular expression search again, using the same search
                    750: string and direction as the last search command.
                    751: .It re-search-backward
                    752: Search backwards using a regular expression.
                    753: Get a search string from the user, and search, starting at dot
                    754: and proceeding toward the front of the buffer.
1.39      jmc       755: If found, dot is left
1.37      kjell     756: pointing at the first character of the pattern [the last character that
                    757: was matched].
                    758: .It re-search-forward
                    759: Search forward using a regular expression.
                    760: Get a search string from the user and search for it starting at dot.
                    761: If found, move dot to just after the matched characters.
                    762: display does all
                    763: the hard stuff.
                    764: If not found, it just prints a message.
                    765: .It recenter
                    766: Reposition dot in the current window.
1.39      jmc       767: By default, the dot is centered.
1.37      kjell     768: If given a positive argument (n), the display is repositioned to line
                    769: n.
                    770: If
                    771: .Va n
1.40      sobrado   772: is negative, it is that line from the bottom.
1.37      kjell     773: .It redraw-display
                    774: Refresh the display.
                    775: Recomputes all window sizes in case something has changed.
1.69      jasper    776: .It revert-buffer
                    777: Revert the current buffer to the latest file on disk.
1.37      kjell     778: .It save-buffer
                    779: Save the contents of the current buffer if it has been changed,
                    780: optionally creating a backup copy.
                    781: .It save-buffers-kill-emacs
1.40      sobrado   782: Offer to save modified buffers and quit
                    783: .Nm .
1.37      kjell     784: .It save-some-buffers
                    785: Look through the list of buffers, offering to save any buffer that
                    786: has been changed.
                    787: Buffers that are not associated with files (such
                    788: as *scratch*, *grep*, *compile*) are ignored.
                    789: .It scroll-down
                    790: Scroll backwards
                    791: .Va n
                    792: pages.
                    793: A two-line overlap between pages is
                    794: assumed.
                    795: If given a repeat argument, scrolls back lines, not pages.
                    796: .It scroll-one-line-down
                    797: Scroll the display down
                    798: .Va n
                    799: lines without changing the cursor position.
                    800: .It scroll-one-line-up
                    801: Scroll the display
                    802: .Va n
1.40      sobrado   803: lines up without moving the cursor position.
1.37      kjell     804: .It scroll-other-window
                    805: Scroll the next window in the window list window forward
                    806: .Va n
                    807: pages.
                    808: .It scroll-up
                    809: Scroll forward one page.
                    810: A two-line overlap between pages is
                    811: assumed.
                    812: If given a repeat argument, scrolls back lines, not pages.
                    813: .It search-again
                    814: Search again, using the same search string and direction as the last
                    815: search command.
                    816: .It search-backward
                    817: Reverse search.
                    818: Get a search string from the user, and search, starting
                    819: at dot and proceeding toward the front of the buffer.
                    820: If found, dot is
                    821: left pointing at the first character of the pattern (the last character
                    822: that was matched).
                    823: .It search-forward
                    824: Search forward.
                    825: Get a search string from the user, and search for it
                    826: starting at dot.
                    827: If found, dot gets moved to just after the matched
                    828: characters, if not found, print a message.
                    829: .It self-insert-command
                    830: Insert a character.
                    831: .It set-case-fold-search
1.58      lum       832: Set case-fold searching, causing case not to matter
1.37      kjell     833: in regular expression searches.
                    834: This is the default.
                    835: .It set-default-mode
                    836: Append the supplied mode to the list of default modes
                    837: used by subsequent buffer creation.
                    838: Built in modes include: fill, indent, overwrite, and notab.
                    839: .It set-fill-column
                    840: Prompt the user for a fill column.
                    841: Used by auto-fill-mode.
                    842: .It set-mark-command
1.40      sobrado   843: Sets the mark in the current window to the current dot location.
1.37      kjell     844: .It set-prefix-string
                    845: Sets the prefix string to be used by the 'prefix-region' command.
1.76      lum       846: .It shell-command
                    847: Execute external command from mini-buffer.
1.59      lum       848: .It shell-command-on-region
                    849: Provide the text in region to the shell command as input.
1.37      kjell     850: .It shrink-window
                    851: Shrink current window by one line.
                    852: The window immediately below is expanded to pick up the slack.
                    853: If only one window is present, this command has no effect.
                    854: .It space-to-tabstop
                    855: Insert enough spaces to reach the next tab-stop position.
                    856: By default, tab-stops occur every 8 characters.
                    857: .It split-window-vertically
                    858: Split the current window.
                    859: A window smaller than 3 lines cannot be split.
                    860: .It start-kbd-macro
                    861: Start defining a keyboard macro.
                    862: Macro definition is ended by invoking end-kbd-macro.
                    863: .It suspend-emacs
1.40      sobrado   864: Suspend
                    865: .Nm
                    866: and switch back to alternate screen, if in use.
1.37      kjell     867: .It switch-to-buffer
                    868: Prompt and switch to a new buffer in the current window.
                    869: .It switch-to-buffer-other-window
                    870: Switch to buffer in another window.
                    871: .It toggle-read-only
                    872: Toggle the read-only flag on the current buffer.
                    873: .It transpose-chars
1.86      lum       874: Transpose the two characters in front of and under dot,
                    875: then move forward one character.
1.87      jmc       876: Treat newline characters the same as any other.
1.37      kjell     877: .It undo
                    878: Undo the most recent action.
                    879: If invoked again without an intervening command,
                    880: move the undo pointer to the previous action and undo it.
1.41      kjell     881: .It undo-boundary
                    882: Add an undo boundary.
                    883: This is not usually done interactively.
                    884: .It undo-boundary-toggle
                    885: Toggle whether undo boundaries are generated.
                    886: Undo boundaries are often disabled before operations that should
                    887: be considered atomically undoable.
                    888: .It undo-enable
                    889: Toggle whether undo information is kept.
1.37      kjell     890: .It undo-list
                    891: Show the undo records for the current buffer in a new buffer.
                    892: .It universal-argument
                    893: Repeat the next command 4 times.
                    894: Usually bound to C-u.
1.39      jmc       895: This command may be stacked; e.g.\&
1.37      kjell     896: C-u C-u C-f moves the cursor forward 16 characters.
                    897: .It upcase-region
                    898: Upper case region.
                    899: Change all of the lower case characters in the region to
1.40      sobrado   900: upper case.
1.37      kjell     901: .It upcase-word
                    902: Move the cursor forward by the specified number of words.
1.54      lum       903: As it moves, convert any characters to upper case.
1.79      lum       904: .It visible-bell
1.81      jmc       905: Toggle the visible bell.
                    906: If this toggle is on, the modeline will flash.
1.56      lum       907: .It visit-tags-table
                    908: Record name of the tags file to be used for subsequent find-tag.
1.37      kjell     909: .It what-cursor-position
                    910: Display a bunch of useful information about the current location of
                    911: dot.
                    912: The character under the cursor (in octal), the current line, row,
                    913: and column, and approximate position of the cursor in the file (as a
                    914: percentage) is displayed.
                    915: The column position assumes an infinite
                    916: position display; it does not truncate just because the screen does.
                    917: .It write-file
                    918: Ask for a file name and write the contents of the current buffer to
                    919: that file.
                    920: Update the remembered file name and clear the buffer
                    921: changed flag.
                    922: .It yank
                    923: Yank text from kill-buffer.
1.40      sobrado   924: Unlike emacs, the
                    925: .Nm
                    926: kill buffer consists only
1.37      kjell     927: of the most recent kill.
                    928: It is not a ring.
1.80      lum       929: .El
                    930: .Sh MG DIRED KEY BINDINGS
                    931: Specific key bindings are available in dired mode.
                    932: .Pp
                    933: .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
1.85      lum       934: .It DEL
                    935: dired-unmark-backward
1.80      lum       936: .It SPC
                    937: dired-next-line
                    938: .It !
                    939: dired-shell-command
                    940: .It +
                    941: dired-create-directory
                    942: .It c
1.82      lum       943: dired-do-copy
1.80      lum       944: .It d and C-d
1.82      lum       945: dired-flag-file-deletion
1.80      lum       946: .It e, f and C-m
                    947: dired-find-file
1.84      lum       948: .It g
                    949: dired-revert
1.80      lum       950: .It n
                    951: dired-next-line
                    952: .It o
                    953: dired-find-file-other-window
                    954: .It p
                    955: dired-previous-line
1.83      lum       956: .It q
                    957: quit-window
1.80      lum       958: .It r
1.82      lum       959: dired-do-rename
1.80      lum       960: .It u
1.82      lum       961: dired-unmark
1.80      lum       962: .It x
1.82      lum       963: dired-do-flagged-delete
1.80      lum       964: .It C-v
                    965: dired-scroll-down
                    966: .It M-v
                    967: dired-scroll-up
1.78      jmc       968: .El
1.77      lum       969: .Sh MG DIRED COMMANDS
                    970: The following are a list of the commands specific to dired mode:
                    971: .Bl -tag -width Ds
                    972: .It dired-create-directory
                    973: Create a directory.
1.82      lum       974: .It dired-do-copy
                    975: Copy the file listed on the current line of the dired buffer.
                    976: .It dired-do-flagged-delete
1.77      lum       977: Delete the files that have been flagged for deletion.
1.82      lum       978: .It dired-do-rename
                    979: Rename the file listed on the current line of the dired buffer.
1.77      lum       980: .It dired-find-file
                    981: Open the file on the current line of the dired buffer.
1.78      jmc       982: If the cursor is on a directory it will be opened in dired mode.
1.82      lum       983: .It dired-flag-file-deletion
1.77      lum       984: Flag the file listed on the current line for deletion.
                    985: This is indicated in the buffer by putting a D at the left margin.
1.91      lum       986: No files are actually deleted until the function dired-do-flagged-delete
1.77      lum       987: is executed.
1.82      lum       988: .It dired-find-file-other-window
                    989: Open the file on the current line of the dired buffer in a
                    990: different window.
1.77      lum       991: .It dired-next-line
                    992: Move the cursor to the next line.
                    993: .It dired-other-window
                    994: This function works just like dired, except that it puts the
                    995: dired buffer in another window.
                    996: .It dired-previous-line
                    997: Move the cursor to the previous line.
1.84      lum       998: .It dired-revert
                    999: Refresh the dired buffer.
1.77      lum      1000: .It dired-scroll-down
                   1001: Scroll down the dired buffer.
                   1002: .It dired-scroll-up
                   1003: Scroll up the dired buffer.
1.82      lum      1004: .It dired-unmark
1.77      lum      1005: Remove the deletion flag for the file on the current line.
1.82      lum      1006: .It dired-unmark-backward
1.85      lum      1007: Remove the deletion flag from the file listed on the previous line
                   1008: of the dired buffer, then move up to that line.
1.83      lum      1009: .It quit-window
                   1010: Close the current dired buffer.
1.37      kjell    1011: .El
1.33      kjell    1012: .Sh CONFIGURATION FILES
1.7       aaron    1013: There are two configuration files,
1.65      jmc      1014: .Pa .mg
1.1       deraadt  1015: and
1.3       aaron    1016: .Pa .mg-TERM .
                   1017: Here,
                   1018: .Ev TERM
1.65      jmc      1019: represents the name of the terminal type; e.g. if the terminal type
1.3       aaron    1020: is set to
                   1021: .Dq vt100 ,
1.2       deraadt  1022: .Nm
1.1       deraadt  1023: will use
1.3       aaron    1024: .Pa .mg-vt100
1.6       aaron    1025: as a startup file.
                   1026: The terminal type startup file is used first.
1.33      kjell    1027: .Pp
1.28      jmc      1028: The startup file format is a list of commands, one per line, as used for
1.33      kjell    1029: interactive evaluation.
                   1030: Strings that are normally entered by the user at any subsequent prompts
                   1031: may be specified after the command name; e.g.:
1.28      jmc      1032: .Bd -literal -offset indent
1.37      kjell    1033: global-set-key ")" self-insert-command
1.46      jmc      1034: global-set-key "\e^x\e^f" find-file
                   1035: global-set-key "\ee[Z" backward-char
1.37      kjell    1036: set-default-mode fill
1.28      jmc      1037: set-fill-column 72
1.37      kjell    1038: auto-execute *.c c-mode
1.28      jmc      1039: .Ed
1.88      lum      1040: .Pp
                   1041: Comments can be added to the startup files by placing
                   1042: .Dq \;
                   1043: or
                   1044: .Dq #
                   1045: as the first character of a line.
1.3       aaron    1046: .Sh FILES
1.55      lum      1047: .Bl -tag -width /usr/share/doc/mg/tutorial -compact
1.3       aaron    1048: .It Pa ~/.mg
                   1049: normal startup file
                   1050: .It Pa ~/.mg-TERM
                   1051: terminal-specific startup file
1.63      lum      1052: .It Pa ~/.mg.d
                   1053: alternative backup file location
1.52      lum      1054: .It Pa /usr/share/doc/mg/tutorial
1.51      lum      1055: concise tutorial
1.3       aaron    1056: .El
                   1057: .Sh SEE ALSO
1.56      lum      1058: .Xr ctags 1 ,
1.2       deraadt  1059: .Xr vi 1
1.29      reyk     1060: .Sh CAVEATS
1.37      kjell    1061: Since it is written completely in C, there is currently no
1.54      lum      1062: language in which extensions can be written;
                   1063: however, keys can be rebound and certain parameters can be changed
1.38      kjell    1064: in startup files.
1.33      kjell    1065: .Pp
                   1066: In order to use 8-bit characters (such as German umlauts), the Meta key
                   1067: needs to be disabled via the
                   1068: .Dq meta-key-mode
                   1069: command.
1.75      naddy    1070: .Pp
                   1071: Multi-byte character sets, such as UTF-8, are not supported.