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

1.34    ! kjell       1: .\"    $OpenBSD: mg.1,v 1.33 2008/01/10 20:12:45 kjell Exp $
        !             2: .\" This file is in the public domain.
1.9       niklas      3: .\"
1.34    ! kjell       4: .Dd $Mdocdate: January 10 2008 $
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.17      vincent    12: .Op Ar options
1.22      jmc        13: .Op Ar file ...
1.2       deraadt    14: .Sh DESCRIPTION
                     15: .Nm
1.3       aaron      16: is intended to be a small, fast, and portable editor for
1.33      kjell      17: people who can't (or don't want to) run emacs for one
1.2       deraadt    18: reason or another, or are not familiar with the
                     19: .Xr vi 1
1.6       aaron      20: editor.
                     21: It is compatible with emacs because there shouldn't
1.2       deraadt    22: be any reason to learn more editor types than emacs or
                     23: .Xr vi 1 .
1.16      deraadt    24: .Pp
1.17      vincent    25: The options are as follows:
1.21      henning    26: .Bl -tag -width Ds
1.16      deraadt    27: .It Ar +number
                     28: Go to the line specified by number (do not insert
1.33      kjell      29: a space between the
                     30: .Sq +
                     31: sign and the number).
1.20      mjc        32: If a negative number is specified, the line number counts
                     33: backwards from the end of the file i.e. +-1 will be the last
                     34: line of the file, +-2 will be second last, and so on.
1.17      vincent    35: .It Fl f Ar <mode>
                     36: Run the mode command for all buffers created from
                     37: arguments on the command line, including the
                     38: scratch buffer and all files.
1.21      henning    39: .It Fl n
                     40: Turn off backup file generation.
1.16      deraadt    41: .El
1.33      kjell      42: .Sh WINDOWS AND BUFFERS
                     43: When a file is loaded into
                     44: .Nm ,
                     45: it is stored in a
                     46: .Em buffer .
                     47: This buffer may be displayed on the screen in more than one window.
                     48: At present, windows may only be split horizontally, so each window is
                     49: delineated by a modeline at the bottom.
                     50: If changes are made to a buffer, it will be reflected in all open windows.
                     51: .Sh POINT AND MARK
                     52: The current cursor location in
                     53: .Nm
                     54: is called the
                     55: .Em point .
                     56: It is possible to define a window-specific region of text by setting a second
                     57: location, called the
                     58: .Em mark .
                     59: The
                     60: .Em region
                     61: is the text between point and mark inclusive.
                     62: Deleting the character at the mark position leaves
                     63: the mark at the point of deletion.
                     64: .Pp
                     65: Note: The point and mark are window-specific in
                     66: .Nm ,
                     67: not buffer-specific, as in other emacs flavours.
                     68: .Sh DEFAULT KEY BINDINGS
1.6       aaron      69: Normal editing commands are very similar to Gnu Emacs.
                     70: In the following examples, ^X means control-X, and M-X means Meta-X,
1.4       deraadt    71: where the Meta key may be either a special key on your keyboard
                     72: or the ALT key; otherwise ESC followed by the key X works as well.
                     73: .Pp
                     74: .Bl -tag -width xxxxx -compact
1.11      deraadt    75: .It ^F
1.25      jmc        76: Forward character.
1.11      deraadt    77: .It ^B
1.25      jmc        78: Backwards character.
1.11      deraadt    79: .It ^N
1.25      jmc        80: Next line.
1.11      deraadt    81: .It ^P
1.25      jmc        82: Previous line.
1.11      deraadt    83: .It ^A
1.25      jmc        84: Start of line.
1.11      deraadt    85: .It ^E
1.25      jmc        86: End of line.
1.11      deraadt    87: .It ^D
1.25      jmc        88: Delete current character.
1.11      deraadt    89: .It ^S
1.25      jmc        90: Interactive search forward.
1.11      deraadt    91: .It ^R
1.25      jmc        92: Interactive search backwards.
1.23      deraadt    93: .It M-%
1.25      jmc        94: Interactive search-and-replace.
1.11      deraadt    95: .It ^O
1.25      jmc        96: Open a new line at cursor position.
1.11      deraadt    97: .It ^T
1.25      jmc        98: Transpose characters.
1.11      deraadt    99: .It ^U
1.22      jmc       100: Repeat next command 4 times
1.25      jmc       101: (can be cascaded i.e. ^U^U^F will move 16 characters forward).
1.4       deraadt   102: .Pp
1.11      deraadt   103: .It ^K
1.25      jmc       104: Kill to end of line (placing into kill buffer).
1.11      deraadt   105: .It ^Y
1.25      jmc       106: Yank kill buffer into current location.
1.26      kjell     107: .It ^SPC
1.25      jmc       108: Set mark.
1.11      deraadt   109: .It ^W
1.25      jmc       110: Kill region
                    111: (cuts from previously set mark to current location, into kill buffer).
1.11      deraadt   112: .It M-W
1.25      jmc       113: Copy region (into kill buffer).
1.4       deraadt   114: .Pp
1.11      deraadt   115: .It ^V
1.25      jmc       116: Next page.
1.11      deraadt   117: .It M-V
1.25      jmc       118: Previous page.
1.4       deraadt   119: .It M-<
1.25      jmc       120: Start of buffer.
1.4       deraadt   121: .It M->
1.25      jmc       122: End of buffer.
1.4       deraadt   123: .Pp
1.11      deraadt   124: .It ^X^C
1.26      kjell     125: Save buffers and quit.
1.11      deraadt   126: .It ^X-O
                    127: Next window.
                    128: .It ^X-N
                    129: Next window.
                    130: .It ^X-P
                    131: Previous window.
1.12      deraadt   132: .It ^X-U
1.26      kjell     133: Undo.
                    134: .It ^_
1.12      deraadt   135: Undo.
1.4       deraadt   136: .El
                    137: .Pp
1.33      kjell     138: For a complete set of key bindings, type
1.4       deraadt   139: .Dq M-x describe-bindings .
1.33      kjell     140: .Sh COMMANDS
                    141: Commands are invoked by
                    142: .Dq M-x ,
                    143: or by binding to a key.
                    144: Many commands take an optional numerical parameter,
                    145: .Va n .
                    146: This parameter is set either by
                    147: M-<n> (where
                    148: .Va n
                    149: is the numerical argument) before the command, or by
                    150: one or more invocations of the universal argument, usually bound to C-U.
                    151: When invoked in this manner, the value of the numeric parameter to
                    152: be passed is displayed in the minibuffer before the M-x.
                    153: .\" A complete list of commands is given in mg(5)
                    154: .Sh CONFIGURATION FILES
1.7       aaron     155: There are two configuration files,
1.3       aaron     156: .Pa .mg ,
1.1       deraadt   157: and
1.3       aaron     158: .Pa .mg-TERM .
                    159: Here,
                    160: .Ev TERM
1.15      pvalchev  161: represents the name of your terminal type; e.g., if your terminal type
1.3       aaron     162: is set to
                    163: .Dq vt100 ,
1.2       deraadt   164: .Nm
1.1       deraadt   165: will use
1.3       aaron     166: .Pa .mg-vt100
1.6       aaron     167: as a startup file.
                    168: The terminal type startup file is used first.
1.33      kjell     169: .Pp
1.28      jmc       170: The startup file format is a list of commands, one per line, as used for
1.33      kjell     171: interactive evaluation.
                    172: Strings that are normally entered by the user at any subsequent prompts
                    173: may be specified after the command name; e.g.:
1.28      jmc       174: .Bd -literal -offset indent
                    175: auto-fill-mode
                    176: set-fill-column 72
                    177: global-set-key "\e^x\e^f" find-file
                    178: .Ed
1.3       aaron     179: .Sh FILES
1.8       aaron     180: .Bl -tag -width ~/.mg-TERM -compact
1.3       aaron     181: .It Pa ~/.mg
                    182: normal startup file
                    183: .It Pa ~/.mg-TERM
                    184: terminal-specific startup file
                    185: .El
                    186: .Sh SEE ALSO
1.2       deraadt   187: .Xr vi 1
1.29      reyk      188: .Sh CAVEATS
                    189: .Nm
1.33      kjell     190: differs from other emacs implementations primarily in not having many
                    191: special modes for tasks other than straight editing, and in not having
                    192: special modes that support various programming languages.
                    193: .Pp
1.29      reyk      194: Since it is written completely in C, there is no
1.33      kjell     195: language in which you can write extensions;
                    196: however, you can rebind keys and change certain parameters.
                    197: .Pp
                    198: In order to use 8-bit characters (such as German umlauts), the Meta key
                    199: needs to be disabled via the
                    200: .Dq meta-key-mode
                    201: command.