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

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