LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1102|回复: 0

OpenBSD 3.8 MG 编辑器

[复制链接]
发表于 2005-12-19 18:52:36 | 显示全部楼层 |阅读模式
上星期五装了个OpenBSD 3.8 装完后发现对默认的编辑器MG 一无所知,以前从没有用,以前用Linux 用vim 玩FreeBSD 有ee ,后来上Google 搜了一下,关于MG的东西多为英文,因为这是一个类Emacs的编辑器,以前很少用Emacs ,所以对MG 一窍不通,今天把MG 的man page 翻译了一下部分,希望对各位兄弟有所帮助,不正确的地方,请各位指教!


MG(1)                      OpenBSD Reference Manual                      MG(1)

NAME
     mg - 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 who
     can't (or don't want to) run the real emacs for one reason or another, or
     are 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 emacs
     or vi(1).
        (mg 是一个为那些不能(或不想)运行emacs编辑器或是那些不熟悉Vi编辑器的人们
        设计的一个小型的,快速的和便捷式的编辑器,它是一个类emacs的编辑器,它适合于
        那些由于某种原因不想学习其它诸如emacs或Vi这一类编辑器的人们.)

     The options are as follows:
        (各项参数说明如下: )

     +number
             Go to the line specified by number (do not insert a space between
             the "+" 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 <mode>
             Run the mode command for all buffers created from arguments on
             the 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 following
     examples, ^X means control-X, and M-X means Meta-X, where the Meta key
     may be either a special key on your keyboard or the ALT key; otherwise
     ESC followed by the key X works as well.
     (标准的编辑命令与Gnu Emacs相似,在下面的例子中:^X 表示: Ctr + X; M-X  表示: Mata-X
      Mata 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. (交互式往回查找) ^R
     M-%    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 move
            16 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).(将从前面设置标记的地方开始到当前位置的内容剪切,放入缓存区) ^W
     M-W    Copy region (into kill buffer). (复制当前区域,放入缓存区) M-W

     ^V     Next page. (下一页) ^V
     M-V    Previous page. (上一页) M-V
     M-<    Start of buffer. (到缓存区的起始处) M-<
     M->    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 than
     straight editing, e.g., mail and news, and in not having special modes
     that support various programming languages.  It does have text justifica-
     tion and auto-fill mode.  Since it is written completely in C, there is
     no language in which you can write extensions.  However, you can rebind
     keys and change some parameters.  There are no limits to line length or
     format.  Command, buffer, and file name completion and listing can be
     done 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., if
     your 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 manual
     for 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 be
     done.  The following defines ``{}'' as brackets, and turns on the mode
     that causes the cursor to "blink" to show you matching brackets.

           global-set-key } blink-matching-paren-hack
           blink-matching-paren
           set-default-mode blink

     More complicated key mappings are also possible, though there are some
     internal limitations compared to regular emacs.  An example of how to map
     control characters and sequences follows, illustrating the Gosling-like
     line scrolling characters.

           global-set-key "\^Z" scroll-one-line-up
           global-set-key "\ez" scroll-one-line-down
           global-set-key "\^_" suspend-emacs

FILES
     ~/.mg       normal startup file
     ~/.mg-TERM  terminal-specific startup file

SEE ALSO
     vi(1)

BUGS
     When you type `?' to list possible file names, buffer names, etc., a help
     buffer is created for the possibilities.  In Gnu Emacs, this buffer goes
     away 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 in
     Gnu Emacs.

OpenBSD 3.8                    February 25, 2000                             2
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表