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