Annotation of src/usr.bin/mg/mg.1, Revision 1.49
1.49 ! kjell 1: .\" $OpenBSD: mg.1,v 1.48 2011/01/17 03:12:06 kjell Exp $
1.34 kjell 2: .\" This file is in the public domain.
1.9 niklas 3: .\"
1.49 ! kjell 4: .Dd $Mdocdate: January 17 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
! 516: Join the current line to the previous. If called with an argument,
! 517: join the next line to the current one.
1.37 kjell 518: .It just-one-space
519: Delete any whitespace around dot, then insert a space.
520: .It keyboard-quit
521: Abort the current action.
522: .It kill-buffer
523: Dispose of a buffer, by name.
1.43 kjell 524: If the buffer name does not start and end with an asterisk,
525: prompt the user if the buffer
1.37 kjell 526: has been changed.
527: .It kill-line
528: Kill line.
529: If called without an argument, it kills from dot to the end
530: of the line, unless it is at the end of the line, when it kills the
531: newline.
532: If called with an argument of 0, it kills from the start of the
533: line to dot.
534: If called with a positive argument, it kills from dot
535: forward over that number of newlines.
536: If called with a negative argument
537: it kills any text before dot on the current line, then it kills back
538: abs(n) lines.
539: .It kill-paragraph
540: Delete
541: .Va n
542: paragraphs starting with the current one.
543: .It kill-region
1.39 jmc 544: Kill the currently defined region.
1.37 kjell 545: .It kill-word
546: Delete forward
547: .Va n
548: words.
549: .It line-number-mode
1.39 jmc 550: Toggle whether line and column numbers are displayed in the modeline.
1.37 kjell 551: .It list-buffers
552: Display the list of available buffers.
553: .It load
554: Prompt the user for a filename, and then execute commands
555: from that file.
556: .It local-set-key
557: Bind a key mapping in the local (topmost) mode.
558: .It local-unset-key
559: Unbind a key mapping in the local (topmost) mode.
560: .It make-backup-files
561: Toggle generation of backup files.
562: .It meta-key-mode
563: When disabled, the meta key can be used to insert extended-ascii (8-bit)
564: characters.
565: When enabled, the meta key acts as usual.
566: .It negative-argument
1.39 jmc 567: Process a negative argument for keyboard-invoked functions.
1.37 kjell 568: .It newline
569: Insert a newline into the current buffer.
570: .It newline-and-indent
571: Insert a newline, then enough tabs and spaces to duplicate the indentation
572: of the previous line.
573: Assumes tabs are every eight characters.
574: .It next-line
575: Move forward
576: .Va n
577: lines.
578: .It no-tab-mode
579: Toggle notab mode.
580: In this mode, spaces are inserted rather than tabs.
581: .It not-modified
582: Turn off the modified flag in the current buffer.
583: .It open-line
584: Open up some blank space.
585: Essentially, insert
586: .Va n
587: newlines, then back up over them.
588: .It other-window
589: The command to make the next (down the screen) window the current
590: window.
591: There are no real errors, although the command does nothing if
592: there is only 1 window on the screen.
593: .It overwrite-mode
1.39 jmc 594: Toggle overwrite mode, where typing in a buffer overwrites
1.37 kjell 595: existing characters rather than inserting them.
596: .It prefix-region
597: Inserts a prefix string before each line of a region.
598: The prefix string is settable by using 'set-prefix-string'.
599: .It previous-line
600: Move backwards
601: .Va n
602: lines.
603: .It previous-window
604: This command makes the previous (up the screen) window the
605: current window.
606: There are no errors, although the command does not do
607: a lot if there is only 1 window.
608: .It push-shell
1.40 sobrado 609: Suspend
610: .Nm
611: and switch to alternate screen, if available.
1.37 kjell 612: .It pwd
613: Display current (global) working directory in the status area.
614: .It query-replace
615: Query Replace.
616: Search and replace strings selectively, prompting after each match.
617: .It replace-string
618: Replace string globally without individual prompting.
619: .It query-replace-regexp
620: Replace strings selectively.
621: Does a search and replace operation using regular
622: expressions for both patterns.
623: .It quoted-insert
624: Insert the next character verbatim into the current buffer; i.e. ignore
625: any function bound to that key.
626: .It re-search-again
627: Perform a regular expression search again, using the same search
628: string and direction as the last search command.
629: .It re-search-backward
630: Search backwards using a regular expression.
631: Get a search string from the user, and search, starting at dot
632: and proceeding toward the front of the buffer.
1.39 jmc 633: If found, dot is left
1.37 kjell 634: pointing at the first character of the pattern [the last character that
635: was matched].
636: .It re-search-forward
637: Search forward using a regular expression.
638: Get a search string from the user and search for it starting at dot.
639: If found, move dot to just after the matched characters.
640: display does all
641: the hard stuff.
642: If not found, it just prints a message.
643: .It recenter
644: Reposition dot in the current window.
1.39 jmc 645: By default, the dot is centered.
1.37 kjell 646: If given a positive argument (n), the display is repositioned to line
647: n.
648: If
649: .Va n
1.40 sobrado 650: is negative, it is that line from the bottom.
1.37 kjell 651: .It redraw-display
652: Refresh the display.
653: Recomputes all window sizes in case something has changed.
654: .It save-buffer
655: Save the contents of the current buffer if it has been changed,
656: optionally creating a backup copy.
657: .It save-buffers-kill-emacs
1.40 sobrado 658: Offer to save modified buffers and quit
659: .Nm .
1.37 kjell 660: .It save-some-buffers
661: Look through the list of buffers, offering to save any buffer that
662: has been changed.
663: Buffers that are not associated with files (such
664: as *scratch*, *grep*, *compile*) are ignored.
665: .It scroll-down
666: Scroll backwards
667: .Va n
668: pages.
669: A two-line overlap between pages is
670: assumed.
671: If given a repeat argument, scrolls back lines, not pages.
672: .It scroll-one-line-down
673: Scroll the display down
674: .Va n
675: lines without changing the cursor position.
676: .It scroll-one-line-up
677: Scroll the display
678: .Va n
1.40 sobrado 679: lines up without moving the cursor position.
1.37 kjell 680: .It scroll-other-window
681: Scroll the next window in the window list window forward
682: .Va n
683: pages.
684: .It scroll-up
685: Scroll forward one page.
686: A two-line overlap between pages is
687: assumed.
688: If given a repeat argument, scrolls back lines, not pages.
689: .It search-again
690: Search again, using the same search string and direction as the last
691: search command.
692: .It search-backward
693: Reverse search.
694: Get a search string from the user, and search, starting
695: at dot and proceeding toward the front of the buffer.
696: If found, dot is
697: left pointing at the first character of the pattern (the last character
698: that was matched).
699: .It search-forward
700: Search forward.
701: Get a search string from the user, and search for it
702: starting at dot.
703: If found, dot gets moved to just after the matched
704: characters, if not found, print a message.
705: .It self-insert-command
706: Insert a character.
707: .It set-case-fold-search
708: Set case-fold searching, causing case nopt to matter
709: in regular expression searches.
710: This is the default.
711: .It set-default-mode
712: Append the supplied mode to the list of default modes
713: used by subsequent buffer creation.
714: Built in modes include: fill, indent, overwrite, and notab.
715: .It set-fill-column
716: Prompt the user for a fill column.
717: Used by auto-fill-mode.
718: .It set-mark-command
1.40 sobrado 719: Sets the mark in the current window to the current dot location.
1.37 kjell 720: .It set-prefix-string
721: Sets the prefix string to be used by the 'prefix-region' command.
722: .It shrink-window
723: Shrink current window by one line.
724: The window immediately below is expanded to pick up the slack.
725: If only one window is present, this command has no effect.
726: .It space-to-tabstop
727: Insert enough spaces to reach the next tab-stop position.
728: By default, tab-stops occur every 8 characters.
729: .It split-window-vertically
730: Split the current window.
731: A window smaller than 3 lines cannot be split.
732: .It start-kbd-macro
733: Start defining a keyboard macro.
734: Macro definition is ended by invoking end-kbd-macro.
735: .It suspend-emacs
1.40 sobrado 736: Suspend
737: .Nm
738: and switch back to alternate screen, if in use.
1.37 kjell 739: .It switch-to-buffer
740: Prompt and switch to a new buffer in the current window.
741: .It switch-to-buffer-other-window
742: Switch to buffer in another window.
743: .It toggle-read-only
744: Toggle the read-only flag on the current buffer.
745: .It transpose-chars
746: Transpose the two characters on either side of dot.
1.39 jmc 747: If dot is at the end of the line, transpose the two characters before it.
1.37 kjell 748: Return with an error if dot is at the beginning of line;
1.39 jmc 749: it seems to be a bit pointless to
1.37 kjell 750: make this work.
751: .It undo
752: Undo the most recent action.
753: If invoked again without an intervening command,
754: move the undo pointer to the previous action and undo it.
1.41 kjell 755: .It undo-boundary
756: Add an undo boundary.
757: This is not usually done interactively.
758: .It undo-boundary-toggle
759: Toggle whether undo boundaries are generated.
760: Undo boundaries are often disabled before operations that should
761: be considered atomically undoable.
762: .It undo-enable
763: Toggle whether undo information is kept.
1.37 kjell 764: .It undo-list
765: Show the undo records for the current buffer in a new buffer.
766: .It universal-argument
767: Repeat the next command 4 times.
768: Usually bound to C-u.
1.39 jmc 769: This command may be stacked; e.g.\&
1.37 kjell 770: C-u C-u C-f moves the cursor forward 16 characters.
771: .It upcase-region
772: Upper case region.
773: Change all of the lower case characters in the region to
1.40 sobrado 774: upper case.
1.37 kjell 775: .It upcase-word
776: Move the cursor forward by the specified number of words.
777: As you move, convert any characters to upper case.
778: .It what-cursor-position
779: Display a bunch of useful information about the current location of
780: dot.
781: The character under the cursor (in octal), the current line, row,
782: and column, and approximate position of the cursor in the file (as a
783: percentage) is displayed.
784: The column position assumes an infinite
785: position display; it does not truncate just because the screen does.
786: .It write-file
787: Ask for a file name and write the contents of the current buffer to
788: that file.
789: Update the remembered file name and clear the buffer
790: changed flag.
791: .It yank
792: Yank text from kill-buffer.
1.40 sobrado 793: Unlike emacs, the
794: .Nm
795: kill buffer consists only
1.37 kjell 796: of the most recent kill.
797: It is not a ring.
798: .El
1.33 kjell 799: .Sh CONFIGURATION FILES
1.7 aaron 800: There are two configuration files,
1.3 aaron 801: .Pa .mg ,
1.1 deraadt 802: and
1.3 aaron 803: .Pa .mg-TERM .
804: Here,
805: .Ev TERM
1.15 pvalchev 806: represents the name of your terminal type; e.g., if your terminal type
1.3 aaron 807: is set to
808: .Dq vt100 ,
1.2 deraadt 809: .Nm
1.1 deraadt 810: will use
1.3 aaron 811: .Pa .mg-vt100
1.6 aaron 812: as a startup file.
813: The terminal type startup file is used first.
1.33 kjell 814: .Pp
1.28 jmc 815: The startup file format is a list of commands, one per line, as used for
1.33 kjell 816: interactive evaluation.
817: Strings that are normally entered by the user at any subsequent prompts
818: may be specified after the command name; e.g.:
1.28 jmc 819: .Bd -literal -offset indent
1.37 kjell 820: global-set-key ")" self-insert-command
1.46 jmc 821: global-set-key "\e^x\e^f" find-file
822: global-set-key "\ee[Z" backward-char
1.37 kjell 823: set-default-mode fill
1.28 jmc 824: set-fill-column 72
1.37 kjell 825: auto-execute *.c c-mode
1.28 jmc 826: .Ed
1.3 aaron 827: .Sh FILES
1.8 aaron 828: .Bl -tag -width ~/.mg-TERM -compact
1.3 aaron 829: .It Pa ~/.mg
830: normal startup file
831: .It Pa ~/.mg-TERM
832: terminal-specific startup file
833: .El
834: .Sh SEE ALSO
1.2 deraadt 835: .Xr vi 1
1.29 reyk 836: .Sh CAVEATS
1.37 kjell 837: Since it is written completely in C, there is currently no
1.33 kjell 838: language in which you can write extensions;
1.38 kjell 839: however, you can rebind keys and change certain parameters
840: in startup files.
1.33 kjell 841: .Pp
842: In order to use 8-bit characters (such as German umlauts), the Meta key
843: needs to be disabled via the
844: .Dq meta-key-mode
845: command.