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

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