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

MG DIRED KEY BINDINGS

850     Specific key bindings are available in dired mode.
851
852           DEL                 dired-unmark-backward
853           RET, e, f and C-m   dired-find-file
854           SPC                 dired-next-line
855           !                   dired-shell-command
856           +                   dired-create-directory
857           a                   dired-find-alternate-file
858           c                   dired-do-copy
859           d and C-d           dired-flag-file-deletion
860           g                   dired-revert
861           n                   dired-next-line
862           o                   dired-find-file-other-window
863           p                   dired-previous-line
864           q                   quit-window
865           r                   dired-do-rename
866           u                   dired-unmark
867           x                   dired-do-flagged-delete
868           C-v                 dired-scroll-down
869           M-v                 dired-scroll-up
870

MG DIRED COMMANDS

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

CONFIGURATION FILES

934     There are two configuration files, .mg and .mg-TERM.  Here, TERM repre‐
935     sents the name of the terminal type; e.g. if the terminal type is set to
936     “vt100”, mg will use .mg-vt100 as a startup file.  The terminal type
937     startup file is used first.
938
939     The startup file format is a list of commands, one per line, as used for
940     interactive evaluation.  Strings that are normally entered by the user at
941     any subsequent prompts may be specified after the command name; e.g.:
942
943           global-set-key ")" self-insert-command
944           global-set-key "\^x\^f" find-file
945           global-set-key "\e[Z" backward-char
946           set-default-mode fill
947           set-fill-column 72
948           auto-execute *.c c-mode
949
950     Comments can be added to the startup files by placing “;” or “#” as the
951     first character of a line.
952

FILES

954     ~/.mg                       normal startup file
955     ~/.mg-TERM                  terminal-specific startup file
956     ~/.mg.d                     alternative backup file location
957     /usr/share/doc/mg/tutorial  concise tutorial
958

SEE ALSO

960     ctags(1), vi(1)
961

CAVEATS

963     Since it is written completely in C, there is currently no language in
964     which extensions can be written; however, keys can be rebound and certain
965     parameters can be changed in startup files.
966
967     In order to use 8-bit characters (such as German umlauts), the Meta key
968     needs to be disabled via the “meta-key-mode” command.
969
970     Multi-byte character sets, such as UTF-8, are not supported.
971
972BSD                              June 20, 2019                             BSD
Impressum