MG(1) OpenBSD Reference Manual MG(1)NAMEmg - emacs-like text editor(mg- 类emacs的文本编辑器)SYNOPSIS(大纲)mg [options] [file ...](mg [参数] [文件名...])DESCRIPTION (描述)mg is intended to be a small, fast, and portable editor for people whocan't (or don't want to) run the real emacs for one reason or another, orare not familiar with the vi(1) editor. It is compatible with emacs be-cause there shouldn't be any reason to learn more editor types than emacsor vi(1).(mg 是一个为那些不能(或不想)运行emacs编辑器或是那些不熟悉Vi编辑器的人们设计的一个小型的,快速的和便捷式的编辑器,它是一个类emacs的编辑器,它适合于那些由于某种原因不想学习其它诸如emacs或Vi这一类编辑器的人们.)The options are as follows:(各项参数说明如下: )+numberGo to the line specified by number (do not insert a space betweenthe "+" sign and the number). If a negative number is specified,the line number counts backwards from the end of the file i.e.+-1 will be the last line of the file, +-2 will be second last,and so on.+数字进入到文件由所带数字指定的行(不要在"+"和数字之间插入空格).如果你指定的数字为负数,则表示定位到从文件末尾开始倒数由数字指定的行数,例如:+-1 表示定位到文件的倒数第一行(即文件的最后一行).+-2 表示定位到文件的倒数第二行,依次类推.-f Run the mode command for all buffers created from arguments onthe command line, including the scratch buffer and all files.-f 指定mg的运行模式......-n Turn off backup file generation.-n 关掉自动生成备份文件夹.Normal editing commands are very similar to Gnu Emacs. In the followingexamples, ^X means control-X, and M-X means Meta-X, where the Meta keymay be either a special key on your keyboard or the ALT key; otherwiseESC followed by the key X works as well.(标准的编辑命令与Gnu Emacs相似,在下面的例子中:^X 表示: Ctr + X; M-X 表示: Mata-XMata key 在Emacs 中是特指键盘左边的 Alt 键.)^F Forward character. (向前移一个字符) ^F^B Backwards character. (向后一个字符) ^B^N Next line. (向下移一行) ^N^P Previous line. (向前移一行) ^P^A Start of line. (移到行首) ^A^E End of line. (移到行尾) ^E^D Delete current character. (删除当前一个字符) ^D^S Interactive search forward. (交互式向下查找) ^S^R Interactive search backwards. (交互式往回查找) ^RM-% Interactive search-and-replace. (交互式查找-替换) M-% (Alt+%)^O Open a new line at cursor position. (在当前光标处新插入一行) ^O^T Transpose characters. (转换字符?) ^T^U Repeat next command 4 times (can be cascaded i.e. ^U^U^F will move16 characters forward). (重复执行接下来的命令4次) ^U^K Kill to end of line (placing into kill buffer).(清除到行尾放入缓存区?) ^K^Y Yank kill buffer into current location. (将缓存区的贴在当前位置) ^Y^@ Set mark. (设置标记?) ^@^W Kill region (cuts from previously set mark to current location,into kill buffer).(将从前面设置标记的地方开始到当前位置的内容剪切,放入缓存区) ^WM-W Copy region (into kill buffer). (复制当前区域,放入缓存区) M-W^V Next page. (下一页) ^VM-V Previous page. (上一页) M-VM- End of buffer. (到缓存区的末尾处) M->^X^C Quit (you will be asked if you want to save files). (退出mg编辑器--会问你是否想保存修改过的文件)^X^C^X-O Next window. (下一个窗口)^X-N Next window. (下一个窗口)^X-P Previous window.(前一个窗口) ^X-p^X-U Undo. (撤消)For more key bindings, type ``M-x describe-bindings''.mg differs primarily in not having special modes for tasks other thanstraight editing, e.g., mail and news, and in not having special modesthat support various programming languages. It does have text justifica-tion and auto-fill mode. Since it is written completely in C, there isno language in which you can write extensions. However, you can rebindkeys and change some parameters. There are no limits to line length orformat. Command, buffer, and file name completion and listing can bedone using the spacebar and `?', respectively.Amongst other major differences, the mg configuration files are much sim-pler than real emacs. There are two configuration files, .mg, and .mg-TERM. Here, TERM represents the name of your terminal type; e.g., ifyour terminal type is set to ``vt100'', mg will use .mg-vt100 as a start-up file. The terminal type startup file is used first. See the manualfor a full list of the commands that can go in the files.Here's another example sequence that you may find useful. By default,``()'' and ``[]'' are recognized as brackets, so bracket matching can bedone. The following defines ``{}'' as brackets, and turns on the modethat causes the cursor to "blink" to show you matching brackets.global-set-key } blink-matching-paren-hackblink-matching-parenset-default-mode blinkMore complicated key mappings are also possible, though there are someinternal limitations compared to regular emacs. An example of how to mapcontrol characters and sequences follows, illustrating the Gosling-likeline scrolling characters.global-set-key "\^Z" scroll-one-line-upglobal-set-key "\ez" scroll-one-line-downglobal-set-key "\^_" suspend-emacsFILES~/.mg normal startup file~/.mg-TERM terminal-specific startup fileSEE ALSOvi(1)BUGSWhen you type `?' to list possible file names, buffer names, etc., a helpbuffer is created for the possibilities. In Gnu Emacs, this buffer goesaway the next time you type a real command. In mg, you must use "^X-1"to get rid of it.The undo feature has minor differences compared to the same feature inGnu Emacs.OpenBSD 3.8 February 25, 2000 2
02-12 03:42