Emacs tutorial. See end for copying conditions.Emacs教程。可以查看并且打印。Emacs commands generally involve the CONTROL key (sometimes labeledCTRL or CTL) or the META Key (sometimes labeled EDIT or ALT). Rather than write that in full each time, we'll use the following abbreviations: C-means hold the CONTROL key while typing the character. Thus, C-f would be: hold the CONTROL key and type f. M-means hold the META or EDIT or ALT key down while typing. If there is no META, EDIT or ALT key, instead press and release the ESC key and then type. We write for the ESC key.Important note: to end the Emacs session, type C-x C-c. (Two characters.)To quit a partially entered command, type C-g.The characters ">>" at the left margin indicate directions for you to try using a command. For instance:
Emacs命令行通常包括CONTROL键(有时候被标记为CTRL或者CTL)或者META键(有时候被标记为EDIT或者ALT)。为了不每次使用全称,我们将会使用如下缩写:C-意味着按下CONTROL键同时按下字母。因此,C-f是:按住CONTROL键然后按住f。M-意味着按下META或者EDIT或者ALT键同时键入。如果没有META,EDIT或者ALT键,就用按下并且释放ESC键然后按下。我们把ESC键命名为。重要提示:结束Emacs会话,按下C-x C-c。(两个字母。)退出已经部分输入的命令行,键入C-g。在左侧边缘的字母>>是你用来使用命令的指南。举个例子:
[Middle of page left blank for didactic purposes. Text continues below]
页面中间留下的空白是用来教学的。文本下面继续
>> Now type C-v (View next screen) to move to the next screen. (go ahead, do it by holding down the CONTROL key while typing v).From now on, you should do this again whenever you finish reading the screen.Note that there is an overlap of two lines when you move from screen to screen; this provides some continuity so you can continue reading the text.The first thing that you need to know is how to move around from place to place in the text. You already know how to move former one screen, with C-v. To move backwards one screen, type M-v (hold down the META key and type v, or type v if you do not have a META, EDIT, or ALT key).
现在键入C-v(得到下一个屏幕)来移动到下一个屏幕。
(提前声明,在你按住CONTROL键的同时按下v)
从现在开始,在你读完屏幕的时候都应该再次这样做。
记住在你移动屏幕的时候有两条重叠的线;这是为了给你继续阅读提供连续性。
第一件你所要知道的事情是如何在文本中从一个位置移动到另一个位置。你已经知道移动到前一个屏幕,键入C-v。移动到后一个屏幕,键入M-v(按住META键并且键入v,或者如果你没有META,EDIT或者ALT键输入ESC v)。
>>Try typing M-v and then C-v, a few times.
*SUMMARY
--------
The following commands are useful for viewing screenfuls:
C-v Move forward one screenful
M-v Move backward one successful
C-l Clear screen and redisplay all the text,
moving the text around the cursor
to the center of the screen.
(That's CONTROL-L, not CONTROL-1.)
>> Find the cursor, and note what text is near it. Then type C-l.
Find the cursor again and notice that the same text is still near
the cursor, but now it is in the center of the screen.
If you press C-l again, this piece of text will move to the top of
the screen. Press C-l again, and it moves to the bottom.
You can also use the PageUp and PageDn keys to move by screenfuls, if
your terminal has them, but you can edit more effciently if you use
C-v and M-v.
尝试键入M-v然后键入几次C-v
总结
下面的命令对浏览全屏幕是非常有帮助的
C-v 移动到前一个屏幕
M-v 移动到后一个屏幕
C-l 清空屏幕并且重新显示所有文本
找到光标,并且记住靠近它的文本。然后键入C-l。
再次找到光标并且注意同样的文本也是靠近光标的,但是现在它在屏幕中央。
如果你再次按住C-l,这块文本将会移动到屏幕顶部。再次键入C-l,它移动到屏幕底部了。
如果你的终端有他们,你也可以使用PageUp和PageDn键来移动屏幕,但是使用C-v和M-v会让你更高效。
* BASIC CURSOR CONTROL
----------------------
基本的光标操作
Moving from screenful to screnful is useful, but how do you
move to a specific place within the text on the screen?
切换屏幕很容易,可是你如何移动到屏幕的特定位置?
There are several ways you can do this. You can use the arrow keys,
but it's more efficient to keep your hands in the standard position
and use the commands C-p, C-b, C-f, and C-n. The characters
are euqivalent to the four arrow keys, like this:
Previous line, C-p
:
:
Backward, C-b .... Current cursor position .... Forward, C-f
:
:
Next line, C-n
>>Move the cursor to the line in the middle of that diagram
using C-n or C-p. Then type C-l to see the whole diagram
centered in the screen.
有很多种方法可以做到这样。你可以使用方向键,但是把手放在标准的位置上使用C-p,C-b,C-f,C-n会让你更高效。这些字母等价于四个方向键,就像这样:
前一行, C-p
:
:
后退, C-b .... 当前光标位置 .... 前进, C-f
:
:
下一行,C-n
>>用C-n,C-p把光标移动到图标中间的那一行。然后键入C-l在屏幕中间的整个图表。
You'll find it easy to remember these letters by words they stand for:
P for previous, N for next, B for backward and F for forward. You
will be using these basic cursor positioning commands all the time.
>> Do a few C-n's to bring the cursor down to this line.
>> Move into the line with C-f's and then up with C-p's.
See what C-p does when the cursor is in the middle of the line.
Each line of text ends with a Newline character, which serves to
separate it from the following line. (Normally, the last line in
a file will have a new line at the end, but Emacs does not require it.)
>> Try to C-b at the beginning of a line. It should move to
the end of the previous line. This is because it moves back
across the Newline character.
C-f can move across a Newline just like C-b.
>> Do a few C-b's, so you get a feel for where the cursor is.
Then do C-f's to return to the end of the line.
Then do one more C-f to move to the following line.
你会发现根据词语来记住字母很容易:
P对应前,N对应后,B对应后退,F对应前进。尽可能一直使用这些基础的光标移动命令。
>>按几次C-n把光标移动到这行的下面。
>>用C-f移动到这一行,然后按C-p几次。
看看当光标在行中间的时候会干什么。
每一行都用一个标示区分上下行的换行字母区分。正常来说,文件中的最后一行含有一个新的换行符,
但是Emacs并不需要它。
>>尝试在行开头用C-b,他应该移动到前一行的末尾。这是因为Emacs经过换行符移动的。
C-f可以像C-b一样跨过换行符。
>>按几次C-b,你能找到光标移动的感觉。然后按几次C-f把光标移动到行尾。然后可以按更多次C-f将其移动到下一行。