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