Annotation of src/usr.bin/mg/mg.1, Revision 1.46
1.46 ! jmc 1: .\" $OpenBSD: mg.1,v 1.45 2009/06/23 19:45:10 nicm Exp $
1.34 kjell 2: .\" This file is in the public domain.
1.9 niklas 3: .\"
1.46 ! jmc 4: .Dd $Mdocdate: June 23 2009 $
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.43 kjell 53: .Pp
54: If a buffer name begins and ends with an asterisk, the buffer is considered
1.44 jmc 55: throwaway; i.e. the user will not be prompted to save changes when
1.43 kjell 56: the buffer is killed.
1.33 kjell 57: .Sh POINT AND MARK
58: The current cursor location in
59: .Nm
60: is called the
1.39 jmc 61: .Em point
1.37 kjell 62: (or
63: .Em dot ) .
1.33 kjell 64: It is possible to define a window-specific region of text by setting a second
65: location, called the
66: .Em mark .
67: The
68: .Em region
69: is the text between point and mark inclusive.
70: Deleting the character at the mark position leaves
71: the mark at the point of deletion.
72: .Pp
73: Note: The point and mark are window-specific in
74: .Nm ,
75: not buffer-specific, as in other emacs flavours.
76: .Sh DEFAULT KEY BINDINGS
1.6 aaron 77: Normal editing commands are very similar to Gnu Emacs.
1.37 kjell 78: In the following examples, C-x means control-X, and M-x means Meta-X,
1.4 deraadt 79: where the Meta key may be either a special key on your keyboard
80: or the ALT key; otherwise ESC followed by the key X works as well.
81: .Pp
1.37 kjell 82: .Bl -tag -width xxxxxxxxxx -compact
83: .It C-SPC
84: set-mark-command
85: .It C-a
86: beginning-of-line
87: .It C-b
88: backward-char
89: .It C-d
90: delete-char
91: .It C-e
92: end-of-line
93: .It C-f
94: forward-char
95: .It C-g
96: keyboard-quit
97: .It C-h C-h
98: help-help
99: .It C-h a
100: apropos
101: .It C-h b
102: describe-bindings
103: .It C-h c
104: describe-key-briefly
105: .It C-j
106: newline-and-indent
107: .It C-k
108: kill-line
109: .It C-l
110: recenter
111: .It RET
112: newline
113: .It C-n
114: next-line
115: .It C-o
116: open-line
117: .It C-p
118: previous-line
119: .It C-q
120: quoted-insert
121: .It C-r
122: isearch-backward
123: .It C-s
124: isearch-forward
125: .It C-t
126: transpose-chars
127: .It C-u
128: universal-argument
129: .It C-v
130: scroll-up
131: .It C-w
132: kill-region
133: .It C-x C-b
134: list-buffers
135: .It C-x C-c
136: save-buffers-kill-emacs
137: .It C-x C-f
138: find-file
139: .It C-x C-g
140: keyboard-quit
141: .It C-x C-l
142: downcase-region
143: .It C-x C-o
144: delete-blank-lines
145: .It C-x C-q
146: toggle-read-only
147: .It C-x C-r
148: find-file-read-only
149: .It C-x C-s
150: save-buffer
151: .It C-x C-u
152: upcase-region
153: .It C-x C-v
154: find-alternate-file
155: .It C-x C-w
156: write-file
157: .It C-x C-x
158: exchange-point-and-mark
159: .It C-x (
160: start-kbd-macro
1.45 nicm 161: .It C-x \&)
1.37 kjell 162: end-kbd-macro
163: .It C-x 0
164: delete-window
165: .It C-x 1
166: delete-other-windows
167: .It C-x 2
168: split-window-vertically
169: .It C-x 4 C-f
170: find-file-other-window
171: .It C-x 4 C-g
172: keyboard-quit
173: .It C-x 4 b
174: switch-to-buffer-other-window
175: .It C-x 4 f
176: find-file-other-window
177: .It C-x =
178: what-cursor-position
179: .It C-x ^
180: enlarge-window
181: .It C-x `
182: next-error
183: .It C-x b
184: switch-to-buffer
185: .It C-x d
186: dired
187: .It C-x e
188: call-last-kbd-macro
189: .It C-x f
190: set-fill-column
191: .It C-x g
192: goto-line
193: .It C-x i
194: insert-file
195: .It C-x k
196: kill-buffer
197: .It C-x n
198: other-window
199: .It C-x o
200: other-window
201: .It C-x p
202: previous-window
203: .It C-x s
204: save-some-buffers
205: .It C-x u
206: undo
207: .It C-y
208: yank
209: .It C-z
210: suspend-emacs
211: .It M-C-v
212: scroll-other-window
213: .It M-SPC
214: just-one-space
1.23 deraadt 215: .It M-%
1.37 kjell 216: query-replace
1.4 deraadt 217: .It M-<
1.37 kjell 218: beginning-of-buffer
1.4 deraadt 219: .It M->
1.37 kjell 220: end-of-buffer
221: .It M-\e
222: delete-horizontal-space
223: .It M-b
224: backward-word
225: .It M-c
226: capitalize-word
227: .It M-d
228: kill-word
229: .It M-f
230: forward-word
231: .It M-l
232: downcase-word
233: .It M-q
234: fill-paragraph
235: .It M-r
236: search-backward
237: .It M-s
238: search-forward
239: .It M-u
240: upcase-word
241: .It M-v
242: scroll-down
243: .It M-w
244: copy-region-as-kill
245: .It M-x
246: execute-extended-command
247: .It M-{
248: backward-paragraph
249: .It M-}
250: forward-paragraph
251: .It M-~
252: not-modified
253: .It M-DEL
254: backward-kill-word
255: .It C-_
256: undo
257: .It )
258: blink-and-insert
259: .It DEL
260: delete-backward-char
1.4 deraadt 261: .El
262: .Pp
1.37 kjell 263: For a complete description of
264: .Nm
265: commands, see
266: .Sx MG COMMANDS .
267: To see the active keybindings at any time, type
1.4 deraadt 268: .Dq M-x describe-bindings .
1.37 kjell 269: .Sh MG COMMANDS
1.33 kjell 270: Commands are invoked by
271: .Dq M-x ,
272: or by binding to a key.
273: Many commands take an optional numerical parameter,
274: .Va n .
275: This parameter is set either by
276: M-<n> (where
277: .Va n
278: is the numerical argument) before the command, or by
279: one or more invocations of the universal argument, usually bound to C-U.
280: When invoked in this manner, the value of the numeric parameter to
281: be passed is displayed in the minibuffer before the M-x.
1.39 jmc 282: One common use of the parameter is in mode toggles (e.g.\&
1.37 kjell 283: make-backup-files).
284: If no parameter is supplied, the mode is toggled to its
285: alternate state.
286: If a positive parameter is supplied, the mode is forced to on.
287: Otherwise, it is forced to off.
288: .\"
289: .Bl -tag -width xxxxx
290: .It apropos
291: Help Apropos.
292: Prompt the user for a string, open the *help* buffer,
293: and list all
294: .Nm
295: commands that contain that string.
296: .It auto-execute
297: Register an auto-execute hook; that is, specify a filename pattern
298: (conforming to the shell's filename globbing rules) and an associated
299: function to execute when a file matching the specified pattern
300: is read into a buffer.
301: .It auto-fill-mode
302: Toggle auto-fill mode (sometimes called mail-mode),
303: where text inserted past the fill column is automatically wrapped
304: to a new line.
305: .It auto-indent-mode
1.39 jmc 306: Toggle indent mode, where indentation is preserved after a newline.
1.37 kjell 307: .It backward-char
308: Move cursor backwards one character.
309: .It backward-kill-word
310: Kill text backwards by
311: .Va n
312: words.
313: .It backward-paragraph
314: Move cursor backwards
315: .Va n
316: paragraphs.
317: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
318: .It backward-word
319: Move cursor backwards by the specified number of words.
320: .It beginning-of-buffer
321: Move cursor to the top of the buffer.
322: .It beginning-of-line
323: Move cursor to the beginning of the line.
324: .It blink-and-insert
325: Self-insert a character, then search backwards and blink its
326: matching delimeter.
327: For delimeters other than
328: parenthesis, brackets, and braces, the character itself
329: is used as its own match.
330: .It bsmap-mode
331: Toggle bsmap mode, where DEL and c-H are swapped.
1.42 sobrado 332: .It c-mode
333: Toggle a KNF-compliant mode for editing C program files.
1.37 kjell 334: .It call-last-kbd-macro
335: Invoke the keyboard macro.
336: .It capitalize-word
337: Capitalize
338: .Va n
339: words; i.e. convert the first character of the word to
340: upper case, and subsequent letters to lower case.
341: .It cd
342: Change the global working directory.
343: See also global-wd-mode.
344: .It copy-region-as-kill
345: Copy all of the characters in the region to the kill buffer,
346: clearing the mark afterwards.
347: This is a bit like a kill-region followed by a yank.
348: .It count-matches
349: Count the number of lines matching the supplied regular expression.
350: .It count-non-matches
351: Count the number of lines not matching the supplied regular expression.
352: .It define-key
1.39 jmc 353: Prompts the user for a named keymap (mode),
1.40 sobrado 354: a key, and an
355: .Nm
356: command, then creates a keybinding in the appropriate
1.37 kjell 357: map.
358: .It delete-backward-char
359: Delete backwards
360: .Va n
361: characters.
362: Like delete-char, this actually does a kill if presented
363: with an argument.
364: .It delete-blank-lines
365: Delete blank lines around dot.
366: If dot is sitting on a blank line, this command
367: deletes all the blank lines above and below the current line.
368: Otherwise, it deletes all of the blank lines after the current line.
369: .It delete-char
370: Delete
371: .Va n
372: characters forward.
373: If any argument is present, it kills rather than deletes,
374: saving the result in the kill buffer.
375: .It delete-horizontal-space
376: Delete any whitespace around the dot.
377: .It delete-leading-space
378: Delete leading whitespace on the current line.
379: .It delete-trailing-space
380: Delete trailing whitespace on the current line.
381: .It delete-matching-lines
382: Delete all lines after dot that contain a string matching
383: the supplied regular expression.
384: .It delete-non-matching-lines
385: Delete all lines after dot that contain a string matching
386: the supplied regular expression.
387: .It delete-other-windows
388: Make the current window the only window visible on the screen.
389: .It delete-window
390: Delete current window.
391: .It describe-bindings
392: List all global and local keybindings, putting the result in
393: the *help* buffer.
394: .It describe-key-briefly
395: Read a key from the keyboard, and look it up in the keymap.
396: Display the name of the function currently bound to the key.
397: .It digit-argument
398: Process a numerical argument for keyboard-invoked functions.
399: .It downcase-region
400: Set all characters in the region to lower case.
401: .It downcase-word
402: Set characters to lower case, starting at the dot, and ending
403: .Va n
404: words away.
405: .It emacs-version
1.40 sobrado 406: Return an
407: .Nm
408: version string.
1.37 kjell 409: .It end-kbd-macro
410: Stop defining a keyboard macro.
411: .It end-of-buffer
412: Move cursor to the end of the buffer.
413: .It end-of-line
1.40 sobrado 414: Move cursor to the end of the line.
1.37 kjell 415: .It enlarge-window
416: Enlarge the current window by shrinking either the window above
417: or below it.
418: .It eval-current-buffer
1.40 sobrado 419: Evaluate the current buffer as a series of
420: .Nm
421: commands.
1.37 kjell 422: Useful for testing
423: .Nm
424: startup files.
425: .It eval-expression
426: Get one line from the user, and run it.
427: Useful for testing expressions in
428: .Nm
429: startup files.
430: .It exchange-point-and-mark
431: Swap the values of "dot" and "mark" in the current window.
432: Return an error if no mark is set.
433: .It execute-extended-command
434: Invoke an extended command; i.e. M-x.
435: Call the message line routine to read in the command name and apply
436: autocompletion to it.
437: When it comes back, look the name up in the symbol table and run the
438: command if it is found, passing arguments as necessary.
439: Print an error if there is anything wrong.
440: .It fill-paragraph
441: Justify a paragraph, wrapping text at the current fill column.
442: .It find-file
443: Select a file for editing.
444: First check if you can find the file
445: in another buffer; if you can find it, just switch to the buffer.
1.39 jmc 446: If you cannot find the file, create a new buffer, read in the
1.37 kjell 447: file from disk, and switch to the new buffer.
448: .It find-file-read-only
449: Same as find-file, except the new buffer is set to read-only.
450: .It find-alternate-file
451: Replace the current file with an alternate one.
452: Semantics for finding the replacement file are the same as
1.39 jmc 453: find-file, except the current buffer is killed before the switch.
1.37 kjell 454: If the kill fails, or is aborted, revert to the original file.
455: .It find-file-other-window
456: Opens the specified file in a second buffer.
457: Splits the current window if necessary.
458: .It forward-char
459: Move cursor forwards (or backwards, if
460: .Va n
461: is negative)
462: .Va n
463: characters.
464: Returns an error if the end of buffer is reached.
465: .It forward-paragraph
466: Move forward
467: .Va n
468: paragraphs.
1.39 jmc 469: Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>.
1.37 kjell 470: .It forward-word
471: Move the cursor forward by the specified number of words.
472: .It global-set-key
473: Bind a key in the global (fundamental) key map.
474: .It global-unset-key
1.40 sobrado 475: Unbind a key from the global (fundamental) key map; i.e. set it to 'rescan'.
1.37 kjell 476: .It global-wd-mode
477: Toggle global working-directory mode.
478: When enabled,
479: .Nm
480: defaults to opening files (and executing commands like compile and grep)
1.39 jmc 481: relative to the global working directory.
1.37 kjell 482: When disabled, a working directory is set for each buffer.
483: .It goto-line
484: Go to a specific line.
485: If an argument is present, then
486: it is the line number, else prompt for a line number to use.
487: .It help-help
1.39 jmc 488: Prompts for one of (a)propos, (b)indings, des(c)ribe key briefly.
1.37 kjell 489: .It insert
490: Insert a string, mainly for use from macros.
491: .It insert-buffer
1.40 sobrado 492: Insert the contents of another buffer at dot.
1.37 kjell 493: .It insert-file
494: Insert a file into the current buffer at dot.
495: .It insert-with-wrap
496: Insert the bound character with word wrap.
497: Check to see if we're past the fill column, and if so,
498: justify this line.
499: .It isearch-backward
500: Use incremental searching, initially in the reverse direction.
501: isearch ignores any explicit arguments.
1.39 jmc 502: If invoked during macro definition or evaluation, the non-incremental
1.37 kjell 503: search-backward is invoked instead.
504: .It isearch-forward
505: Use incremental searching, initially in the forward direction.
506: isearch ignores any explicit arguments.
1.39 jmc 507: If invoked during macro definition or evaluation, the non-incremental
1.37 kjell 508: search-forward is invoked instead.
509: .It just-one-space
510: Delete any whitespace around dot, then insert a space.
511: .It keyboard-quit
512: Abort the current action.
513: .It kill-buffer
514: Dispose of a buffer, by name.
1.43 kjell 515: If the buffer name does not start and end with an asterisk,
516: prompt the user if the buffer
1.37 kjell 517: has been changed.
518: .It kill-line
519: Kill line.
520: If called without an argument, it kills from dot to the end
521: of the line, unless it is at the end of the line, when it kills the
522: newline.
523: If called with an argument of 0, it kills from the start of the
524: line to dot.
525: If called with a positive argument, it kills from dot
526: forward over that number of newlines.
527: If called with a negative argument
528: it kills any text before dot on the current line, then it kills back
529: abs(n) lines.
530: .It kill-paragraph
531: Delete
532: .Va n
533: paragraphs starting with the current one.
534: .It kill-region
1.39 jmc 535: Kill the currently defined region.
1.37 kjell 536: .It kill-word
537: Delete forward
538: .Va n
539: words.
540: .It line-number-mode
1.39 jmc 541: Toggle whether line and column numbers are displayed in the modeline.
1.37 kjell 542: .It list-buffers
543: Display the list of available buffers.
544: .It load
545: Prompt the user for a filename, and then execute commands
546: from that file.
547: .It local-set-key
548: Bind a key mapping in the local (topmost) mode.
549: .It local-unset-key
550: Unbind a key mapping in the local (topmost) mode.
551: .It make-backup-files
552: Toggle generation of backup files.
553: .It meta-key-mode
554: When disabled, the meta key can be used to insert extended-ascii (8-bit)
555: characters.
556: When enabled, the meta key acts as usual.
557: .It negative-argument
1.39 jmc 558: Process a negative argument for keyboard-invoked functions.
1.37 kjell 559: .It newline
560: Insert a newline into the current buffer.
561: .It newline-and-indent
562: Insert a newline, then enough tabs and spaces to duplicate the indentation
563: of the previous line.
564: Assumes tabs are every eight characters.
565: .It next-line
566: Move forward
567: .Va n
568: lines.
569: .It no-tab-mode
570: Toggle notab mode.
571: In this mode, spaces are inserted rather than tabs.
572: .It not-modified
573: Turn off the modified flag in the current buffer.
574: .It open-line
575: Open up some blank space.
576: Essentially, insert
577: .Va n
578: newlines, then back up over them.
579: .It other-window
580: The command to make the next (down the screen) window the current
581: window.
582: There are no real errors, although the command does nothing if
583: there is only 1 window on the screen.
584: .It overwrite-mode
1.39 jmc 585: Toggle overwrite mode, where typing in a buffer overwrites
1.37 kjell 586: existing characters rather than inserting them.
587: .It prefix-region
588: Inserts a prefix string before each line of a region.
589: The prefix string is settable by using 'set-prefix-string'.
590: .It previous-line
591: Move backwards
592: .Va n
593: lines.
594: .It previous-window
595: This command makes the previous (up the screen) window the
596: current window.
597: There are no errors, although the command does not do
598: a lot if there is only 1 window.
599: .It push-shell
1.40 sobrado 600: Suspend
601: .Nm
602: and switch to alternate screen, if available.
1.37 kjell 603: .It pwd
604: Display current (global) working directory in the status area.
605: .It query-replace
606: Query Replace.
607: Search and replace strings selectively, prompting after each match.
608: .It replace-string
609: Replace string globally without individual prompting.
610: .It query-replace-regexp
611: Replace strings selectively.
612: Does a search and replace operation using regular
613: expressions for both patterns.
614: .It quoted-insert
615: Insert the next character verbatim into the current buffer; i.e. ignore
616: any function bound to that key.
617: .It re-search-again
618: Perform a regular expression search again, using the same search
619: string and direction as the last search command.
620: .It re-search-backward
621: Search backwards using a regular expression.
622: Get a search string from the user, and search, starting at dot
623: and proceeding toward the front of the buffer.
1.39 jmc 624: If found, dot is left
1.37 kjell 625: pointing at the first character of the pattern [the last character that
626: was matched].
627: .It re-search-forward
628: Search forward using a regular expression.
629: Get a search string from the user and search for it starting at dot.
630: If found, move dot to just after the matched characters.
631: display does all
632: the hard stuff.
633: If not found, it just prints a message.
634: .It recenter
635: Reposition dot in the current window.
1.39 jmc 636: By default, the dot is centered.
1.37 kjell 637: If given a positive argument (n), the display is repositioned to line
638: n.
639: If
640: .Va n
1.40 sobrado 641: is negative, it is that line from the bottom.
1.37 kjell 642: .It redraw-display
643: Refresh the display.
644: Recomputes all window sizes in case something has changed.
645: .It save-buffer
646: Save the contents of the current buffer if it has been changed,
647: optionally creating a backup copy.
648: .It save-buffers-kill-emacs
1.40 sobrado 649: Offer to save modified buffers and quit
650: .Nm .
1.37 kjell 651: .It save-some-buffers
652: Look through the list of buffers, offering to save any buffer that
653: has been changed.
654: Buffers that are not associated with files (such
655: as *scratch*, *grep*, *compile*) are ignored.
656: .It scroll-down
657: Scroll backwards
658: .Va n
659: pages.
660: A two-line overlap between pages is
661: assumed.
662: If given a repeat argument, scrolls back lines, not pages.
663: .It scroll-one-line-down
664: Scroll the display down
665: .Va n
666: lines without changing the cursor position.
667: .It scroll-one-line-up
668: Scroll the display
669: .Va n
1.40 sobrado 670: lines up without moving the cursor position.
1.37 kjell 671: .It scroll-other-window
672: Scroll the next window in the window list window forward
673: .Va n
674: pages.
675: .It scroll-up
676: Scroll forward one page.
677: A two-line overlap between pages is
678: assumed.
679: If given a repeat argument, scrolls back lines, not pages.
680: .It search-again
681: Search again, using the same search string and direction as the last
682: search command.
683: .It search-backward
684: Reverse search.
685: Get a search string from the user, and search, starting
686: at dot and proceeding toward the front of the buffer.
687: If found, dot is
688: left pointing at the first character of the pattern (the last character
689: that was matched).
690: .It search-forward
691: Search forward.
692: Get a search string from the user, and search for it
693: starting at dot.
694: If found, dot gets moved to just after the matched
695: characters, if not found, print a message.
696: .It self-insert-command
697: Insert a character.
698: .It set-case-fold-search
699: Set case-fold searching, causing case nopt to matter
700: in regular expression searches.
701: This is the default.
702: .It set-default-mode
703: Append the supplied mode to the list of default modes
704: used by subsequent buffer creation.
705: Built in modes include: fill, indent, overwrite, and notab.
706: .It set-fill-column
707: Prompt the user for a fill column.
708: Used by auto-fill-mode.
709: .It set-mark-command
1.40 sobrado 710: Sets the mark in the current window to the current dot location.
1.37 kjell 711: .It set-prefix-string
712: Sets the prefix string to be used by the 'prefix-region' command.
713: .It shrink-window
714: Shrink current window by one line.
715: The window immediately below is expanded to pick up the slack.
716: If only one window is present, this command has no effect.
717: .It space-to-tabstop
718: Insert enough spaces to reach the next tab-stop position.
719: By default, tab-stops occur every 8 characters.
720: .It split-window-vertically
721: Split the current window.
722: A window smaller than 3 lines cannot be split.
723: .It start-kbd-macro
724: Start defining a keyboard macro.
725: Macro definition is ended by invoking end-kbd-macro.
726: .It suspend-emacs
1.40 sobrado 727: Suspend
728: .Nm
729: and switch back to alternate screen, if in use.
1.37 kjell 730: .It switch-to-buffer
731: Prompt and switch to a new buffer in the current window.
732: .It switch-to-buffer-other-window
733: Switch to buffer in another window.
734: .It toggle-read-only
735: Toggle the read-only flag on the current buffer.
736: .It transpose-chars
737: Transpose the two characters on either side of dot.
1.39 jmc 738: If dot is at the end of the line, transpose the two characters before it.
1.37 kjell 739: Return with an error if dot is at the beginning of line;
1.39 jmc 740: it seems to be a bit pointless to
1.37 kjell 741: make this work.
742: .It undo
743: Undo the most recent action.
744: If invoked again without an intervening command,
745: move the undo pointer to the previous action and undo it.
1.41 kjell 746: .It undo-boundary
747: Add an undo boundary.
748: This is not usually done interactively.
749: .It undo-boundary-toggle
750: Toggle whether undo boundaries are generated.
751: Undo boundaries are often disabled before operations that should
752: be considered atomically undoable.
753: .It undo-enable
754: Toggle whether undo information is kept.
1.37 kjell 755: .It undo-list
756: Show the undo records for the current buffer in a new buffer.
757: .It universal-argument
758: Repeat the next command 4 times.
759: Usually bound to C-u.
1.39 jmc 760: This command may be stacked; e.g.\&
1.37 kjell 761: C-u C-u C-f moves the cursor forward 16 characters.
762: .It upcase-region
763: Upper case region.
764: Change all of the lower case characters in the region to
1.40 sobrado 765: upper case.
1.37 kjell 766: .It upcase-word
767: Move the cursor forward by the specified number of words.
768: As you move, convert any characters to upper case.
769: .It what-cursor-position
770: Display a bunch of useful information about the current location of
771: dot.
772: The character under the cursor (in octal), the current line, row,
773: and column, and approximate position of the cursor in the file (as a
774: percentage) is displayed.
775: The column position assumes an infinite
776: position display; it does not truncate just because the screen does.
777: .It write-file
778: Ask for a file name and write the contents of the current buffer to
779: that file.
780: Update the remembered file name and clear the buffer
781: changed flag.
782: .It yank
783: Yank text from kill-buffer.
1.40 sobrado 784: Unlike emacs, the
785: .Nm
786: kill buffer consists only
1.37 kjell 787: of the most recent kill.
788: It is not a ring.
789: .El
1.33 kjell 790: .Sh CONFIGURATION FILES
1.7 aaron 791: There are two configuration files,
1.3 aaron 792: .Pa .mg ,
1.1 deraadt 793: and
1.3 aaron 794: .Pa .mg-TERM .
795: Here,
796: .Ev TERM
1.15 pvalchev 797: represents the name of your terminal type; e.g., if your terminal type
1.3 aaron 798: is set to
799: .Dq vt100 ,
1.2 deraadt 800: .Nm
1.1 deraadt 801: will use
1.3 aaron 802: .Pa .mg-vt100
1.6 aaron 803: as a startup file.
804: The terminal type startup file is used first.
1.33 kjell 805: .Pp
1.28 jmc 806: The startup file format is a list of commands, one per line, as used for
1.33 kjell 807: interactive evaluation.
808: Strings that are normally entered by the user at any subsequent prompts
809: may be specified after the command name; e.g.:
1.28 jmc 810: .Bd -literal -offset indent
1.37 kjell 811: global-set-key ")" self-insert-command
1.46 ! jmc 812: global-set-key "\e^x\e^f" find-file
! 813: global-set-key "\ee[Z" backward-char
1.37 kjell 814: set-default-mode fill
1.28 jmc 815: set-fill-column 72
1.37 kjell 816: auto-execute *.c c-mode
1.28 jmc 817: .Ed
1.3 aaron 818: .Sh FILES
1.8 aaron 819: .Bl -tag -width ~/.mg-TERM -compact
1.3 aaron 820: .It Pa ~/.mg
821: normal startup file
822: .It Pa ~/.mg-TERM
823: terminal-specific startup file
824: .El
825: .Sh SEE ALSO
1.2 deraadt 826: .Xr vi 1
1.29 reyk 827: .Sh CAVEATS
1.37 kjell 828: Since it is written completely in C, there is currently no
1.33 kjell 829: language in which you can write extensions;
1.38 kjell 830: however, you can rebind keys and change certain parameters
831: in startup files.
1.33 kjell 832: .Pp
833: In order to use 8-bit characters (such as German umlauts), the Meta key
834: needs to be disabled via the
835: .Dq meta-key-mode
836: command.