1MG(1)                     BSD General Commands Manual                    MG(1)
2

NAME

4     mg — emacs-like text editor
5

SYNOPSIS

7     mg [-nR] [-f mode] [+number] [file ...]
8

DESCRIPTION

10     mg is intended to be a small, fast, and portable editor for people who
11     can't (or don't want to) run emacs for one reason or another, or are not
12     familiar with the vi(1) editor.  It is compatible with emacs because
13     there shouldn't be any reason to learn more editor types than emacs or
14     vi(1).
15
16     The options are as follows:
17
18     +number
19             Go to the line specified by number (do not insert a space between
20             the ‘+’ sign and the number).  If a negative number is specified,
21             the line number counts backwards from the end of the file i.e.
22             +-1 will be the last line of the file, +-2 will be second last,
23             and so on.
24
25     -f mode
26             Run the mode command for all buffers created from arguments on
27             the command line, including the scratch buffer and all files.
28
29     -n      Turn off backup file generation.
30
31     -R      Files specified on the command line will be opened read-only.
32

WINDOWS AND BUFFERS

34     When a file is loaded into mg, it is stored in a buffer.  This buffer may
35     be displayed on the screen in more than one window.  At present, windows
36     may only be split horizontally, so each window is delineated by a mode‐
37     line at the bottom.  If changes are made to a buffer, it will be
38     reflected in all open windows.
39
40     If a file is changed outside mg and its buffer is about to be changed, mg
41     prompts if the change should go ahead (y), not go ahead (n) or if the
42     buffer should be reverted (r) to the latest file on disk.
43
44     If a buffer name begins and ends with an asterisk, the buffer is consid‐
45     ered throwaway; i.e. the user will not be prompted to save changes when
46     the buffer is killed.
47

POINT AND MARK

49     The current cursor location in mg is called the point (or dot).  It is
50     possible to define a window-specific region of text by setting a second
51     location, called the mark.  The region is the text between point and mark
52     inclusive.  Deleting the character at the mark position leaves the mark
53     at the point of deletion.
54
55     Note: The point and mark are window-specific in mg, not buffer-specific,
56     as in other emacs flavours.
57

BACKUP FILES

59     Backup files have a ‘~’ character appended to the file name and are cre‐
60     ated in the current working directory by default.  Whether to create
61     backup files or not can be toggled with the make-backup-files command.
62     The backup file location can either be in the current working directory,
63     or all backups can be moved to a ~/.mg.d directory where files retain
64     their path name to retain uniqueness.  Use the backup-to-home-directory
65     to alternate between these two locations.  Further, if any application
66     creates backup files in /tmp, these can be left with the leave-tmpdir-
67     backups command.
68

TAGS

70     mg supports tag files created by ctags(1), allowing the user to quickly
71     locate various object definitions.  Note though that emacs uses etags,
72     not ctags.
73

CSCOPE

75     mg supports navigating source code using cscope.  However, mg requires
76     cscope and cscope-indexer executables to be present in PATH for it to
77     work.
78

DEFAULT KEY BINDINGS

80     Normal editing commands are very similar to GNU Emacs.  In the following
81     examples, C-x means Control-x, and M-x means Meta-x, where the Meta key
82     may be either a special key on the keyboard or the ALT key; otherwise ESC
83     followed by the key X works as well.
84
85           C-SPC         set-mark-command
86           C-a           beginning-of-line
87           C-b           backward-char
88           C-c s c       cscope-find-functions-calling-this-function
89           C-c s d       cscope-find-global-definition
90           C-c s e       cscope-find-egrep-pattern
91           C-c s f       cscope-find-this-file
92           C-c s i       cscope-find-files-including-file
93           C-c s n       cscope-next-symbol
94           C-c s p       cscope-prev-symbol
95           C-c s s       cscope-find-this-symbol
96           C-c s t       cscope-find-this-text-string
97           C-d           delete-char
98           C-e           end-of-line
99           C-f           forward-char
100           C-g           keyboard-quit
101           C-h C-h       help-help
102           C-h a         apropos
103           C-h b         describe-bindings
104           C-h c         describe-key-briefly
105           C-j           newline-and-indent
106           C-k           kill-line
107           C-l           recenter
108           RET           newline
109           C-n           next-line
110           C-o           open-line
111           C-p           previous-line
112           C-q           quoted-insert
113           C-r           isearch-backward
114           C-s           isearch-forward
115           C-t           transpose-chars
116           C-u           universal-argument
117           C-v           scroll-up
118           C-w           kill-region
119           C-x C-b       list-buffers
120           C-x C-c       save-buffers-kill-emacs
121           C-x C-f       find-file
122           C-x C-g       keyboard-quit
123           C-x C-l       downcase-region
124           C-x C-o       delete-blank-lines
125           C-x C-q       toggle-read-only
126           C-x C-r       find-file-read-only
127           C-x C-s       save-buffer
128           C-x C-u       upcase-region
129           C-x C-v       find-alternate-file
130           C-x C-w       write-file
131           C-x C-x       exchange-point-and-mark
132           C-x (         start-kbd-macro
133           C-x )         end-kbd-macro
134           C-x 0         delete-window
135           C-x 1         delete-other-windows
136           C-x 2         split-window-vertically
137           C-x 4 C-f     find-file-other-window
138           C-x 4 C-g     keyboard-quit
139           C-x 4 b       switch-to-buffer-other-window
140           C-x 4 f       find-file-other-window
141           C-x =         what-cursor-position
142           C-x ^         enlarge-window
143           C-x `         next-error
144           C-x b         switch-to-buffer
145           C-x d         dired
146           C-x e         call-last-kbd-macro
147           C-x f         set-fill-column
148           C-x g         goto-line
149           C-x h         mark-whole-buffer
150           C-x i         insert-file
151           C-x k         kill-buffer
152           C-x n         other-window
153           C-x o         other-window
154           C-x p         previous-window
155           C-x s         save-some-buffers
156           C-x u         undo
157           C-y           yank
158           C-z           suspend-emacs
159           M-C-v         scroll-other-window
160           M-SPC         just-one-space
161           M-!           shell-command
162           M-.           find-tag
163           M-*           pop-tag-mark
164           M-%           query-replace
165           M-<           beginning-of-buffer
166           M->           end-of-buffer
167           M-\           delete-horizontal-space
168           M-^           join-line
169           M-b           backward-word
170           M-c           capitalize-word
171           M-d           kill-word
172           M-f           forward-word
173           M-h           mark-paragraph
174           M-l           downcase-word
175           M-m           back-to-indentation
176           M-q           fill-paragraph
177           M-r           search-backward
178           M-s           search-forward
179           M-t           transpose-words
180           M-u           upcase-word
181           M-v           scroll-down
182           M-w           copy-region-as-kill
183           M-x           execute-extended-command
184           M-{           backward-paragraph
185           M-|           shell-command-on-region
186           M-}           forward-paragraph
187           M-~           not-modified
188           M-DEL         backward-kill-word
189           C-_           undo
190           )             blink-and-insert
191           DEL           delete-backward-char
192
193     For a complete description of mg commands, see MG COMMANDS.  To see the
194     active keybindings at any time, type “M-x describe-bindings”.
195

MG COMMANDS

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

MG DIRED KEY BINDINGS

862     Specific key bindings are available in dired mode.
863
864           DEL                 dired-unmark-backward
865           RET, e, f and C-m   dired-find-file
866           SPC, n              dired-next-line
867           !                   dired-shell-command
868           +                   dired-create-directory
869           a                   dired-find-alternate-file
870           c                   dired-do-copy
871           d and C-d           dired-flag-file-deletion
872           g                   dired-revert
873           j                   dired-goto-file
874           o                   dired-find-file-other-window
875           p                   dired-previous-line
876           q                   quit-window
877           r                   dired-do-rename
878           u                   dired-unmark
879           x                   dired-do-flagged-delete
880           C-v                 dired-scroll-down
881           M-v                 dired-scroll-up
882

MG DIRED COMMANDS

884     The following are a list of the commands specific to dired mode:
885
886     dired-create-directory
887             Create a directory.
888
889     dired-do-copy
890             Copy the file listed on the current line of the dired buffer.
891
892     dired-do-flagged-delete
893             Delete the files that have been flagged for deletion.
894
895     dired-do-rename
896             Rename the file listed on the current line of the dired buffer.
897
898     dired-find-alternate-file
899             Replace the current dired buffer with an alternate one as speci‐
900             fied by the position of the cursor in the dired buffer.
901
902     dired-find-file
903             Open the file on the current line of the dired buffer.  If the
904             cursor is on a directory it will be opened in dired mode.
905
906     dired-flag-file-deletion
907             Flag the file listed on the current line for deletion.  This is
908             indicated in the buffer by putting a D at the left margin.  No
909             files are actually deleted until the function dired-do-flagged-
910             delete is executed.
911
912     dired-find-file-other-window
913             Open the file on the current line of the dired buffer in a dif‐
914             ferent window.
915
916     dired-goto-file
917             Move the cursor to a file name in the dired buffer.
918
919     dired-next-line
920             Move the cursor to the next line.
921
922     dired-other-window
923             This function works just like dired, except that it puts the
924             dired buffer in another window.
925
926     dired-previous-line
927             Move the cursor to the previous line.
928
929     dired-revert
930             Refresh the dired buffer while retaining any flags.
931
932     dired-scroll-down
933             Scroll down the dired buffer.
934
935     dired-scroll-up
936             Scroll up the dired buffer.
937
938     dired-unmark
939             Remove the deletion flag for the file on the current line.
940
941     dired-unmark-backward
942             Remove the deletion flag from the file listed on the previous
943             line of the dired buffer, then move up to that line.
944
945     quit-window
946             Close the current dired buffer.
947

CONFIGURATION FILES

949     There are two configuration files, .mg and .mg-TERM.  Here, TERM repre‐
950     sents the name of the terminal type; e.g. if the terminal type is set to
951     “vt100”, mg will use .mg-vt100 as a startup file.  The terminal type
952     startup file is used first.
953
954     The startup file format is a list of commands, one per line, as used for
955     interactive evaluation.  Strings that are normally entered by the user at
956     any subsequent prompts may be specified after the command name; e.g.:
957
958           global-set-key ")" self-insert-command
959           global-set-key "\^x\^f" find-file
960           global-set-key "\e[Z" backward-char
961           set-default-mode fill
962           set-fill-column 72
963           auto-execute *.c c-mode
964
965     Comments can be added to the startup files by placing ‘;’ or ‘#’ as the
966     first character of a line.
967

FILES

969     ~/.mg                       normal startup file
970     ~/.mg-TERM                  terminal-specific startup file
971     ~/.mg.d                     alternative backup file location
972     /usr/share/doc/mg/tutorial  concise tutorial
973

SEE ALSO

975     ctags(1), vi(1)
976

CAVEATS

978     Since it is written completely in C, there is currently no language in
979     which extensions can be written; however, keys can be rebound and certain
980     parameters can be changed in startup files.
981
982     In order to use 8-bit characters (such as German umlauts), the Meta key
983     needs to be disabled via the “meta-key-mode” command.
984
985     Multi-byte character sets, such as UTF-8, are not supported.
986
987BSD                              May 10, 2020                              BSD
Impressum