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