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