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