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

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