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

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