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

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