1.\" $OpenBSD: mg.1,v 1.118 2019/11/08 19:54:40 solene Exp $ 2.\" This file is in the public domain. 3.\" 4.Dd $Mdocdate: November 8 2019 $ 5.Dt MG 1 6.Os 7.Sh NAME 8.Nm mg 9.Nd emacs-like text editor 10.Sh SYNOPSIS 11.Nm mg 12.Op Fl nR 13.Op Fl f Ar mode 14.Op + Ns Ar number 15.Op Ar 16.Sh DESCRIPTION 17.Nm 18is intended to be a small, fast, and portable editor for 19people who can't (or don't want to) run emacs for one 20reason or another, or are not familiar with the 21.Xr vi 1 22editor. 23It is compatible with emacs because there shouldn't 24be any reason to learn more editor types than emacs or 25.Xr vi 1 . 26.Pp 27The options are as follows: 28.Bl -tag -width Ds 29.It + Ns Ar number 30Go to the line specified by number (do not insert 31a space between the 32.Sq + 33sign and the number). 34If a negative number is specified, the line number counts 35backwards from the end of the file i.e. +-1 will be the last 36line of the file, +-2 will be second last, and so on. 37.It Fl f Ar mode 38Run the mode command for all buffers created from 39arguments on the command line, including the 40scratch buffer and all files. 41.It Fl n 42Turn off backup file generation. 43.It Fl R 44Files specified on the command line will be opened read-only. 45.El 46.Sh WINDOWS AND BUFFERS 47When a file is loaded into 48.Nm , 49it is stored in a 50.Em buffer . 51This buffer may be displayed on the screen in more than one window. 52At present, windows may only be split horizontally, so each window is 53delineated by a modeline at the bottom. 54If changes are made to a buffer, it will be reflected in all open windows. 55.Pp 56If a file is changed outside 57.Nm 58and its buffer is about to be changed, 59.Nm 60prompts if the change should go ahead (y), not go ahead (n) or if the buffer 61should be reverted (r) to the latest file on disk. 62.Pp 63If a buffer name begins and ends with an asterisk, the buffer is considered 64throwaway; i.e. the user will not be prompted to save changes when 65the buffer is killed. 66.Sh POINT AND MARK 67The current cursor location in 68.Nm 69is called the 70.Em point 71(or 72.Em dot ) . 73It is possible to define a window-specific region of text by setting a second 74location, called the 75.Em mark . 76The 77.Em region 78is the text between point and mark inclusive. 79Deleting the character at the mark position leaves 80the mark at the point of deletion. 81.Pp 82Note: The point and mark are window-specific in 83.Nm , 84not buffer-specific, as in other emacs flavours. 85.Sh BACKUP FILES 86Backup files have a 87.Sq ~ 88character appended to the file name and 89are created in the current working directory by default. 90Whether to create backup files or not can be toggled with the 91make-backup-files command. 92The backup file location can either be in the current 93working directory, or all backups can be moved to a 94.Pa ~/.mg.d 95directory where files retain their path name to retain uniqueness. 96Use the backup-to-home-directory to alternate between these two locations. 97Further, if any application creates backup files in 98.Pa /tmp , 99these can be left with the leave-tmpdir-backups command. 100.Sh TAGS 101.Nm 102supports tag files created by 103.Xr ctags 1 , 104allowing the user to quickly locate various object definitions. 105Note though that emacs uses etags, not ctags. 106.Sh CSCOPE 107.Nm 108supports navigating source code using cscope. 109However, 110.Nm 111requires cscope and cscope-indexer executables to be present in 112.Ev PATH 113for it to work. 114.Sh DEFAULT KEY BINDINGS 115Normal editing commands are very similar to GNU Emacs. 116In the following examples, C-x means Control-x, and M-x means Meta-x, 117where the Meta key may be either a special key on the keyboard 118or the ALT key; otherwise ESC followed by the key X works as well. 119.Pp 120.Bl -tag -width xxxxxxxxxxxx -offset indent -compact 121.It C-SPC 122set-mark-command 123.It C-a 124beginning-of-line 125.It C-b 126backward-char 127.It C-c s c 128cscope-find-functions-calling-this-function 129.It C-c s d 130cscope-find-global-definition 131.It C-c s e 132cscope-find-egrep-pattern 133.It C-c s f 134cscope-find-this-file 135.It C-c s i 136cscope-find-files-including-file 137.It C-c s n 138cscope-next-symbol 139.It C-c s p 140cscope-prev-symbol 141.It C-c s s 142cscope-find-this-symbol 143.It C-c s t 144cscope-find-this-text-string 145.It C-d 146delete-char 147.It C-e 148end-of-line 149.It C-f 150forward-char 151.It C-g 152keyboard-quit 153.It C-h C-h 154help-help 155.It C-h a 156apropos 157.It C-h b 158describe-bindings 159.It C-h c 160describe-key-briefly 161.It C-j 162newline-and-indent 163.It C-k 164kill-line 165.It C-l 166recenter 167.It RET 168newline 169.It C-n 170next-line 171.It C-o 172open-line 173.It C-p 174previous-line 175.It C-q 176quoted-insert 177.It C-r 178isearch-backward 179.It C-s 180isearch-forward 181.It C-t 182transpose-chars 183.It C-u 184universal-argument 185.It C-v 186scroll-up 187.It C-w 188kill-region 189.It C-x C-b 190list-buffers 191.It C-x C-c 192save-buffers-kill-emacs 193.It C-x C-f 194find-file 195.It C-x C-g 196keyboard-quit 197.It C-x C-l 198downcase-region 199.It C-x C-o 200delete-blank-lines 201.It C-x C-q 202toggle-read-only 203.It C-x C-r 204find-file-read-only 205.It C-x C-s 206save-buffer 207.It C-x C-u 208upcase-region 209.It C-x C-v 210find-alternate-file 211.It C-x C-w 212write-file 213.It C-x C-x 214exchange-point-and-mark 215.It C-x ( 216start-kbd-macro 217.It C-x \&) 218end-kbd-macro 219.It C-x 0 220delete-window 221.It C-x 1 222delete-other-windows 223.It C-x 2 224split-window-vertically 225.It C-x 4 C-f 226find-file-other-window 227.It C-x 4 C-g 228keyboard-quit 229.It C-x 4 b 230switch-to-buffer-other-window 231.It C-x 4 f 232find-file-other-window 233.It C-x = 234what-cursor-position 235.It C-x ^ 236enlarge-window 237.It C-x ` 238next-error 239.It C-x b 240switch-to-buffer 241.It C-x d 242dired 243.It C-x e 244call-last-kbd-macro 245.It C-x f 246set-fill-column 247.It C-x g 248goto-line 249.It C-x h 250mark-whole-buffer 251.It C-x i 252insert-file 253.It C-x k 254kill-buffer 255.It C-x n 256other-window 257.It C-x o 258other-window 259.It C-x p 260previous-window 261.It C-x s 262save-some-buffers 263.It C-x u 264undo 265.It C-y 266yank 267.It C-z 268suspend-emacs 269.It M-C-v 270scroll-other-window 271.It M-SPC 272just-one-space 273.It M-! 274shell-command 275.It M-. 276find-tag 277.It M-* 278pop-tag-mark 279.It M-% 280query-replace 281.It M-< 282beginning-of-buffer 283.It M-> 284end-of-buffer 285.It M-\e 286delete-horizontal-space 287.It M-^ 288join-line 289.It M-b 290backward-word 291.It M-c 292capitalize-word 293.It M-d 294kill-word 295.It M-f 296forward-word 297.It M-h 298mark-paragraph 299.It M-l 300downcase-word 301.It M-m 302back-to-indentation 303.It M-q 304fill-paragraph 305.It M-r 306search-backward 307.It M-s 308search-forward 309.It M-t 310transpose-words 311.It M-u 312upcase-word 313.It M-v 314scroll-down 315.It M-w 316copy-region-as-kill 317.It M-x 318execute-extended-command 319.It M-{ 320backward-paragraph 321.It M-| 322shell-command-on-region 323.It M-} 324forward-paragraph 325.It M-~ 326not-modified 327.It M-DEL 328backward-kill-word 329.It C-_ 330undo 331.It ) 332blink-and-insert 333.It DEL 334delete-backward-char 335.El 336.Pp 337For a complete description of 338.Nm 339commands, see 340.Sx MG COMMANDS . 341To see the active keybindings at any time, type 342.Dq M-x describe-bindings . 343.Sh MG COMMANDS 344Commands are invoked by 345.Dq M-x , 346or by binding to a key. 347Many commands take an optional numerical parameter, 348.Va n . 349This parameter is set either by 350M-<n> (where 351.Va n 352is the numerical argument) before the command, or by 353one or more invocations of the universal argument, usually bound to C-u. 354When invoked in this manner, the value of the numeric parameter to 355be passed is displayed in the minibuffer before the M-x. 356One common use of the parameter is in mode toggles (e.g.\& 357make-backup-files). 358If no parameter is supplied, the mode is toggled to its 359alternate state. 360If a positive parameter is supplied, the mode is forced to on. 361Otherwise, it is forced to off. 362.\" 363.Bl -tag -width xxxxx 364.It apropos 365Help Apropos. 366Prompt the user for a string, open the *help* buffer, 367and list all 368.Nm 369commands that contain that string. 370.It audible-bell 371Toggle the audible system bell. 372.It auto-execute 373Register an auto-execute hook; that is, specify a filename pattern 374(conforming to the shell's filename globbing rules) and an associated 375function to execute when a file matching the specified pattern 376is read into a buffer. 377.It auto-fill-mode 378Toggle auto-fill mode (sometimes called mail-mode) in the current buffer, 379where text inserted past the fill column is automatically wrapped 380to a new line. 381Can be set globally with set-default-mode. 382.It auto-indent-mode 383Toggle indent mode in the current buffer, 384where indentation is preserved after a newline. 385Can be set globally with set-default-mode. 386.It back-to-indentation 387Move the dot to the first non-whitespace character on the current line. 388.It backup-to-home-directory 389Save backup copies to a 390.Pa ~/.mg.d 391directory instead of working directory. 392Requires make-backup-files to be on. 393.It backward-char 394Move cursor backwards one character. 395.It backward-kill-word 396Kill text backwards by 397.Va n 398words. 399.It backward-paragraph 400Move cursor backwards 401.Va n 402paragraphs. 403Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>. 404.It backward-word 405Move cursor backwards by the specified number of words. 406.It beginning-of-buffer 407Move cursor to the top of the buffer. 408If set, keep mark's position, otherwise set at current position. 409A numeric argument 410.Va n 411will move n/10th of the way from the top. 412.It beginning-of-line 413Move cursor to the beginning of the line. 414.It blink-and-insert 415Self-insert a character, then search backwards and blink its 416matching delimiter. 417For delimiters other than 418parenthesis, brackets, and braces, the character itself 419is used as its own match. 420Can be used in the startup file with the global-set-key command. 421.It bsmap-mode 422Toggle bsmap mode, where DEL and C-h are swapped. 423.It c-mode 424Toggle a KNF-compliant mode for editing C program files. 425.It call-last-kbd-macro 426Invoke the keyboard macro. 427.It capitalize-word 428Capitalize 429.Va n 430words; i.e. convert the first character of the word to 431upper case, and subsequent letters to lower case. 432.It cd 433Change the global working directory. 434See also global-wd-mode. 435.It column-number-mode 436Toggle whether the column number is displayed in the modeline. 437.It copy-region-as-kill 438Copy all of the characters in the region to the kill buffer, 439clearing the mark afterwards. 440This is a bit like a kill-region followed by a yank. 441.It count-matches 442Count the number of lines matching the supplied regular expression. 443.It count-non-matches 444Count the number of lines not matching the supplied regular expression. 445.It cscope-find-this-symbol 446List the matches for the given symbol. 447.It cscope-find-global-definition 448List global definitions for the given literal. 449.It cscope-find-called-functions 450List functions called from the given function. 451.It cscope-find-functions-calling-this-function 452List functions calling the given function. 453.It cscope-find-this-text-string 454List locations matching the given text string. 455.It cscope-find-egrep-pattern 456List locations matching the given extended regular expression pattern. 457.It cscope-find-this-file 458List filenames matching the given filename. 459.It cscope-find-files-including-file 460List files that #include the given filename. 461.It cscope-next-symbol 462Navigate to the next match. 463.It cscope-prev-symbol 464Navigate to the previous match. 465.It cscope-next-file 466Navigate to the next file. 467.It cscope-prev-file 468Navigate to the previous file. 469.It cscope-create-list-of-files-to-index 470Create cscope's List and Index in the given directory. 471.It define-key 472Prompts the user for a named keymap (mode), 473a key, and an 474.Nm 475command, then creates a keybinding in the appropriate 476map. 477.It delete-backward-char 478Delete backwards 479.Va n 480characters. 481Like delete-char, this actually does a kill if presented 482with an argument. 483.It delete-blank-lines 484Delete blank lines around dot. 485If dot is sitting on a blank line, this command 486deletes all the blank lines above and below the current line. 487Otherwise, it deletes all of the blank lines after the current line. 488.It delete-char 489Delete 490.Va n 491characters forward. 492If any argument is present, it kills rather than deletes, 493saving the result in the kill buffer. 494.It delete-horizontal-space 495Delete any whitespace around the dot. 496.It delete-leading-space 497Delete leading whitespace on the current line. 498.It delete-trailing-space 499Delete trailing whitespace on the current line. 500.It delete-matching-lines 501Delete all lines after dot that contain a string matching 502the supplied regular expression. 503.It delete-non-matching-lines 504Delete all lines after dot that don't contain a string matching 505the supplied regular expression. 506.It delete-other-windows 507Make the current window the only window visible on the screen. 508.It delete-window 509Delete current window. 510.It describe-bindings 511List all global and local keybindings, putting the result in 512the *help* buffer. 513.It describe-key-briefly 514Read a key from the keyboard, and look it up in the keymap. 515Display the name of the function currently bound to the key. 516.It diff-buffer-with-file 517View the differences between buffer and its associated file. 518.It digit-argument 519Process a numerical argument for keyboard-invoked functions. 520.It downcase-region 521Set all characters in the region to lower case. 522.It downcase-word 523Set characters to lower case, starting at the dot, and ending 524.Va n 525words away. 526.It emacs-version 527Return an 528.Nm 529version string. 530.It end-kbd-macro 531Stop defining a keyboard macro. 532.It end-of-buffer 533Move cursor to the end of the buffer. 534If set, keep mark's position, otherwise set at current position. 535A numeric argument 536.Va n 537will move n/10th of the way from the end. 538.It end-of-line 539Move cursor to the end of the line. 540.It enlarge-window 541Enlarge the current window by shrinking either the window above 542or below it. 543.It eval-current-buffer 544Evaluate the current buffer as a series of 545.Nm 546commands. 547Useful for testing 548.Nm 549startup files. 550.It eval-expression 551Get one line from the user, and run it. 552Useful for testing expressions in 553.Nm 554startup files. 555.It exchange-point-and-mark 556Swap the values of "dot" and "mark" in the current window. 557Return an error if no mark is set. 558.It execute-extended-command 559Invoke an extended command; i.e. M-x. 560Call the message line routine to read in the command name and apply 561autocompletion to it. 562When it comes back, look the name up in the symbol table and run the 563command if it is found, passing arguments as necessary. 564Print an error if there is anything wrong. 565.It fill-paragraph 566Justify a paragraph, wrapping text at the current fill column. 567.It find-file 568Select a file for editing. 569First check if the file can be found 570in another buffer; if it is there, just switch to that buffer. 571If the file cannot be found, create a new buffer, read in the 572file from disk, and switch to the new buffer. 573.It find-file-read-only 574Same as find-file, except the new buffer is set to read-only. 575.It find-alternate-file 576Replace the current file with an alternate one. 577Semantics for finding the replacement file are the same as 578find-file, except the current buffer is killed before the switch. 579If the kill fails, or is aborted, revert to the original file. 580.It find-file-other-window 581Opens the specified file in a second buffer. 582Splits the current window if necessary. 583.It find-tag 584Jump to definition of tag at dot. 585.It forward-char 586Move cursor forwards (or backwards, if 587.Va n 588is negative) 589.Va n 590characters. 591Returns an error if the end of buffer is reached. 592.It forward-paragraph 593Move forward 594.Va n 595paragraphs. 596Paragraphs are delimited by <NL><NL> or <NL><TAB> or <NL><SPACE>. 597.It forward-word 598Move the cursor forward by the specified number of words. 599.It global-set-key 600Bind a key in the global (fundamental) key map. 601.It global-unset-key 602Unbind a key from the global (fundamental) key map; i.e. set it to 'rescan'. 603.It global-wd-mode 604Toggle global working-directory mode. 605When enabled, 606.Nm 607defaults to opening files (and executing commands like compile and grep) 608relative to the global working directory. 609When disabled, a working directory is set for each buffer. 610.It goto-line 611Go to a specific line. 612If an argument is present, then 613it is the line number, else prompt for a line number to use. 614.It help-help 615Prompts for one of (a)propos, (b)indings, des(c)ribe key briefly. 616.It insert 617Insert a string, mainly for use from macros. 618.It insert-buffer 619Insert the contents of another buffer at dot. 620.It insert-file 621Insert a file into the current buffer at dot. 622.It insert-with-wrap 623Insert the bound character with word wrap. 624Check to see if we're past the fill column, and if so, 625justify this line. 626.It isearch-backward 627Use incremental searching, initially in the reverse direction. 628isearch ignores any explicit arguments. 629If invoked during macro definition or evaluation, the non-incremental 630search-backward is invoked instead. 631.It isearch-forward 632Use incremental searching, initially in the forward direction. 633isearch ignores any explicit arguments. 634If invoked during macro definition or evaluation, the non-incremental 635search-forward is invoked instead. 636.It join-line 637Join the current line to the previous. 638If called with an argument, 639join the next line to the current one. 640.It just-one-space 641Delete any whitespace around dot, then insert a space. 642.It keyboard-quit 643Abort the current action. 644.It kill-buffer 645Dispose of a buffer, by name. 646If the buffer name does not start and end with an asterisk, 647prompt the user if the buffer 648has been changed. 649.It kill-line 650Kill line. 651If called without an argument, it kills from dot to the end 652of the line, unless it is at the end of the line, when it kills the 653newline. 654If called with an argument of 0, it kills from the start of the 655line to dot. 656If called with a positive argument, it kills from dot 657forward over that number of newlines. 658If called with a negative argument 659it kills any text before dot on the current line, then it kills back 660abs(n) lines. 661.It kill-paragraph 662Delete 663.Va n 664paragraphs starting with the current one. 665.It kill-region 666Kill the currently defined region. 667.It kill-word 668Delete forward 669.Va n 670words. 671.It leave-tmpdir-backups 672Modifies the behaviour of backup-to-home-directory. 673Backup files that would normally reside in 674.Pa /tmp 675are left there and not moved to the 676.Pa ~/.mg.d 677directory. 678.It line-number-mode 679Toggle whether the line number is displayed in the modeline. 680.It list-buffers 681Display the list of available buffers. 682.It load 683Prompt the user for a filename, and then execute commands 684from that file. 685.It local-set-key 686Bind a key mapping in the local (topmost) mode. 687.It local-unset-key 688Unbind a key mapping in the local (topmost) mode. 689.It make-backup-files 690Toggle generation of backup files. 691Enabled by default. 692.It make-directory 693Prompt the user for a path or directory name which is then created. 694.It mark-paragraph 695Mark 696.Va n 697paragraphs. 698.It mark-whole-buffer 699Marks whole buffer as a region by putting dot at the beginning and mark 700at the end of buffer. 701.It meta-key-mode 702When disabled, the meta key can be used to insert extended-ascii (8-bit) 703characters. 704When enabled, the meta key acts as usual. 705.It negative-argument 706Process a negative argument for keyboard-invoked functions. 707.It newline 708Insert a newline into the current buffer. 709.It newline-and-indent 710Insert a newline, then enough tabs and spaces to duplicate the indentation 711of the previous line. 712Assumes tabs are every eight characters. 713.It next-line 714Move forward 715.Va n 716lines. 717.\" .It no-tab-mode 718.\" Toggle notab mode. 719.\" In this mode, spaces are inserted rather than tabs. 720.It not-modified 721Turn off the modified flag in the current buffer. 722.It open-line 723Open up some blank space. 724Essentially, insert 725.Va n 726newlines, then back up over them. 727.It other-window 728The command to make the next (down the screen) window the current 729window. 730There are no real errors, although the command does nothing if 731there is only 1 window on the screen. 732.It overwrite-mode 733Toggle overwrite mode in the current buffer, 734where typing overwrites existing characters rather than inserting them. 735Can be set globally with set-default-mode. 736.It prefix-region 737Inserts a prefix string before each line of a region. 738The prefix string is settable by using 'set-prefix-string'. 739.It previous-line 740Move backwards 741.Va n 742lines. 743.It previous-window 744This command makes the previous (up the screen) window the 745current window. 746There are no errors, although the command does not do 747a lot if there is only 1 window. 748.It pop-tag-mark 749Return to position where find-tag was previously invoked. 750.It push-shell 751Suspend 752.Nm 753and switch to alternate screen, if available. 754.It pwd 755Display current (global) working directory in the status area. 756.It query-replace 757Query Replace. 758Search and replace strings selectively, prompting after each match. 759.It replace-string 760Replace string globally without individual prompting. 761.It query-replace-regexp 762Replace strings selectively. 763Does a search and replace operation using regular 764expressions for both patterns. 765.It quoted-insert 766Insert the next character verbatim into the current buffer; i.e. ignore 767any function bound to that key. 768.It re-search-again 769Perform a regular expression search again, using the same search 770string and direction as the last search command. 771.It re-search-backward 772Search backwards using a regular expression. 773Get a search string from the user, and search, starting at dot 774and proceeding toward the front of the buffer. 775If found, dot is left 776pointing at the first character of the pattern [the last character that 777was matched]. 778.It re-search-forward 779Search forward using a regular expression. 780Get a search string from the user and search for it starting at dot. 781If found, move dot to just after the matched characters. 782display does all 783the hard stuff. 784If not found, it just prints a message. 785.It recenter 786Reposition dot in the current window. 787By default, the dot is centered. 788If given a positive argument (n), the display is repositioned to line 789n. 790If 791.Va n 792is negative, it is that line from the bottom. 793.It redraw-display 794Refresh the display. 795Recomputes all window sizes in case something has changed. 796.It revert-buffer 797Revert the current buffer to the latest file on disk. 798.It save-buffer 799Save the contents of the current buffer if it has been changed, 800optionally creating a backup copy. 801.It save-buffers-kill-emacs 802Offer to save modified buffers and quit 803.Nm . 804.It save-some-buffers 805Look through the list of buffers, offering to save any buffer that 806has been changed. 807Buffers that are not associated with files (such 808as *scratch*, *grep*, *compile*) are ignored. 809.It scroll-down 810Scroll backwards 811.Va n 812pages. 813A two-line overlap between pages is 814assumed. 815If given a repeat argument, scrolls back lines, not pages. 816.It scroll-one-line-down 817Scroll the display down 818.Va n 819lines without changing the cursor position. 820.It scroll-one-line-up 821Scroll the display 822.Va n 823lines up without moving the cursor position. 824.It scroll-other-window 825Scroll the next window in the window list window forward 826.Va n 827pages. 828.It scroll-up 829Scroll forward one page. 830A two-line overlap between pages is 831assumed. 832If given a repeat argument, scrolls back lines, not pages. 833.It search-again 834Search again, using the same search string and direction as the last 835search command. 836.It search-backward 837Reverse search. 838Get a search string from the user, and search, starting 839at dot and proceeding toward the front of the buffer. 840If found, dot is 841left pointing at the first character of the pattern (the last character 842that was matched). 843.It search-forward 844Search forward. 845Get a search string from the user, and search for it 846starting at dot. 847If found, dot gets moved to just after the matched 848characters, if not found, print a message. 849.It self-insert-command 850Insert a character. 851.It sentence-end-double-space 852Toggle double or single spaces for end of sentences. 853Double is the default. 854Currently only affects fill-paragraph. 855.It set-case-fold-search 856Set case-fold searching, causing case not to matter 857in regular expression searches. 858This is the default. 859.It set-case-replace 860Preserve the case of the replaced string. 861This is the default. 862.It set-default-mode 863Append the supplied mode to the list of default modes 864used by subsequent buffer creation. 865Built in modes include: fill, indent and overwrite. 866.It set-fill-column 867Prompt the user for a fill column. 868Used by auto-fill-mode. 869.It set-mark-command 870Sets the mark in the current window to the current dot location. 871.It set-prefix-string 872Sets the prefix string to be used by the 'prefix-region' command. 873.It shell-command 874Execute external command from mini-buffer. 875.It shell-command-on-region 876Provide the text in region to the shell command as input. 877.It shrink-window 878Shrink current window by one line. 879The window immediately below is expanded to pick up the slack. 880If only one window is present, this command has no effect. 881.It split-window-vertically 882Split the current window. 883A window smaller than 3 lines cannot be split. 884.It start-kbd-macro 885Start defining a keyboard macro. 886Macro definition is ended by invoking end-kbd-macro. 887.It suspend-emacs 888Suspend 889.Nm 890and switch back to alternate screen, if in use. 891.It switch-to-buffer 892Prompt and switch to a new buffer in the current window. 893.It switch-to-buffer-other-window 894Switch to buffer in another window. 895.It toggle-read-only 896Toggle the read-only flag on the current buffer. 897.It toggle-read-only-all 898Toggle the read-only flag on all non-ephemeral buffers. 899A simple toggle that switches a global read-only flag either on 900or off. 901.It transpose-chars 902Transpose the two characters in front of and under dot, 903then move forward one character. 904Treat newline characters the same as any other. 905.It transpose-paragraphs 906Transpose adjacent paragraphs. 907If multiple iterations are requested, the current paragraph will 908be moved 909.Va n 910paragraphs forward. 911.It transpose-words 912Transpose adjacent words. 913.It undo 914Undo the most recent action. 915If invoked again without an intervening command, 916move the undo pointer to the previous action and undo it. 917.It undo-boundary 918Add an undo boundary. 919This is not usually done interactively. 920.It undo-boundary-toggle 921Toggle whether undo boundaries are generated. 922Undo boundaries are often disabled before operations that should 923be considered atomically undoable. 924.It undo-enable 925Toggle whether undo information is kept. 926.It undo-list 927Show the undo records for the current buffer in a new buffer. 928.It universal-argument 929Repeat the next command 4 times. 930Usually bound to C-u. 931This command may be stacked; e.g.\& 932C-u C-u C-f moves the cursor forward 16 characters. 933.It upcase-region 934Upper case region. 935Change all of the lower case characters in the region to 936upper case. 937.It upcase-word 938Move the cursor forward by the specified number of words. 939As it moves, convert any characters to upper case. 940.It visible-bell 941Toggle the visible bell. 942If this toggle is on, the modeline will flash. 943.It visit-tags-table 944Record name of the tags file to be used for subsequent find-tag. 945.It what-cursor-position 946Display a bunch of useful information about the current location of 947dot. 948The character under the cursor (in octal), the current line, row, 949and column, and approximate position of the cursor in the file (as a 950percentage) is displayed. 951The column position assumes an infinite 952position display; it does not truncate just because the screen does. 953.It write-file 954Ask for a file name and write the contents of the current buffer to 955that file. 956Update the remembered file name and clear the buffer 957changed flag. 958.It yank 959Yank text from kill-buffer. 960Unlike emacs, the 961.Nm 962kill buffer consists only 963of the most recent kill. 964It is not a ring. 965.El 966.Sh MG DIRED KEY BINDINGS 967Specific key bindings are available in dired mode. 968.Pp 969.Bl -tag -width xxxxxxxxxxxxxxxxxx -offset indent -compact 970.It DEL 971dired-unmark-backward 972.It RET, e, f and C-m 973dired-find-file 974.It SPC, n 975dired-next-line 976.It ! 977dired-shell-command 978.It + 979dired-create-directory 980.It a 981dired-find-alternate-file 982.It c 983dired-do-copy 984.It d and C-d 985dired-flag-file-deletion 986.It g 987dired-revert 988.It j 989dired-goto-file 990.It o 991dired-find-file-other-window 992.It p 993dired-previous-line 994.It q 995quit-window 996.It r 997dired-do-rename 998.It u 999dired-unmark 1000.It x 1001dired-do-flagged-delete 1002.It C-v 1003dired-scroll-down 1004.It M-v 1005dired-scroll-up 1006.El 1007.Sh MG DIRED COMMANDS 1008The following are a list of the commands specific to dired mode: 1009.Bl -tag -width Ds 1010.It dired-create-directory 1011Create a directory. 1012.It dired-do-copy 1013Copy the file listed on the current line of the dired buffer. 1014.It dired-do-flagged-delete 1015Delete the files that have been flagged for deletion. 1016.It dired-do-rename 1017Rename the file listed on the current line of the dired buffer. 1018.It dired-find-alternate-file 1019Replace the current dired buffer with an alternate one as specified 1020by the position of the cursor in the dired buffer. 1021.It dired-find-file 1022Open the file on the current line of the dired buffer. 1023If the cursor is on a directory it will be opened in dired mode. 1024.It dired-flag-file-deletion 1025Flag the file listed on the current line for deletion. 1026This is indicated in the buffer by putting a D at the left margin. 1027No files are actually deleted until the function dired-do-flagged-delete 1028is executed. 1029.It dired-find-file-other-window 1030Open the file on the current line of the dired buffer in a 1031different window. 1032.It dired-goto-file 1033Move the cursor to a file name in the dired buffer. 1034.It dired-next-line 1035Move the cursor to the next line. 1036.It dired-other-window 1037This function works just like dired, except that it puts the 1038dired buffer in another window. 1039.It dired-previous-line 1040Move the cursor to the previous line. 1041.It dired-revert 1042Refresh the dired buffer while retaining any flags. 1043.It dired-scroll-down 1044Scroll down the dired buffer. 1045.It dired-scroll-up 1046Scroll up the dired buffer. 1047.It dired-unmark 1048Remove the deletion flag for the file on the current line. 1049.It dired-unmark-backward 1050Remove the deletion flag from the file listed on the previous line 1051of the dired buffer, then move up to that line. 1052.It quit-window 1053Close the current dired buffer. 1054.El 1055.Sh CONFIGURATION FILES 1056There are two configuration files, 1057.Pa .mg 1058and 1059.Pa .mg-TERM . 1060Here, 1061.Ev TERM 1062represents the name of the terminal type; e.g. if the terminal type 1063is set to 1064.Dq vt100 , 1065.Nm 1066will use 1067.Pa .mg-vt100 1068as a startup file. 1069The terminal type startup file is used first. 1070.Pp 1071The startup file format is a list of commands, one per line, as used for 1072interactive evaluation. 1073Strings that are normally entered by the user at any subsequent prompts 1074may be specified after the command name; e.g.: 1075.Bd -literal -offset indent 1076global-set-key ")" self-insert-command 1077global-set-key "\e^x\e^f" find-file 1078global-set-key "\ee[Z" backward-char 1079set-default-mode fill 1080set-fill-column 72 1081auto-execute *.c c-mode 1082.Ed 1083.Pp 1084Comments can be added to the startup files by placing 1085.Sq ;\& 1086or 1087.Sq # 1088as the first character of a line. 1089.Sh FILES 1090.Bl -tag -width /usr/share/doc/mg/tutorial -compact 1091.It Pa ~/.mg 1092normal startup file 1093.It Pa ~/.mg-TERM 1094terminal-specific startup file 1095.It Pa ~/.mg.d 1096alternative backup file location 1097.It Pa /usr/share/doc/mg/tutorial 1098concise tutorial 1099.El 1100.Sh SEE ALSO 1101.Xr ctags 1 , 1102.Xr vi 1 1103.Sh CAVEATS 1104Since it is written completely in C, there is currently no 1105language in which extensions can be written; 1106however, keys can be rebound and certain parameters can be changed 1107in startup files. 1108.Pp 1109In order to use 8-bit characters (such as German umlauts), the Meta key 1110needs to be disabled via the 1111.Dq meta-key-mode 1112command. 1113.Pp 1114Multi-byte character sets, such as UTF-8, are not supported. 1115