Chinaunix首页 | 论坛 | 博客
  • 博客访问: 12485
  • 博文数量: 14
  • 博客积分: 560
  • 博客等级: 中士
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-17 16:40
文章分类
文章存档

2010年(14)

我的朋友
最近访客

分类: LINUX

2010-10-05 18:49:41

2.1.3 Repeating Commands
2.1.3
重复执行指令

Now let's learn some efficiency tricks. Emacs lets you repeat any command as many times as you want to. First, you can repeat a command any number of times by pressing M-n before the command, where n is the number of times you want to repeat it. This command is called the digit-argument command.
   
现在学习一些高效的技巧。Emacs可以无限次的重复执行任何指令。首先,在输入指令前先输入M-nn表示你想重复的次数,你就可以重复执行指令n次。这个指令被称为数字参数(digit-argument)指令。

You can give M-n a large argument if you want it to repeat the command many times. For example, let's say you are editing a large file of 1000 lines. If you typed M-500 C-n, the cursor would move down 500 lines, to the halfway point in the file. If you give M-n a larger argument than it can execute, it repeats the command as many times as possible and then stops.
   
如果想执行很多次,可以给M-n一个很大的参数。例如,假如你正在编辑一个大文档,有1000行。如果你输入M-500 C-n,光标会向下移动500行,到达文件的中间。如果给M-n提供一个比最大可执行次数还大的参数,那么Emacs会最大限度的重复执行指令然后停止。

There's another multiplier command you can use, too: C-u (the universal-argument command). You can give C-u an argument just like you do M-n. Typing either M-5 or C-u 5 repeats the command that follows five times. But unlike M-n, C-u doesn't need an argument to repeat commands. With no argument, C-u executes the next command four times. If you type C-u C-u, it executes the command 16 times. In this way, you can stack up C-u's to make commands execute many times: 16, 64, 256, and so on.[2]
   
还有另一个复合指令可以使用:C-u(全局变量指令).你可以给C-u一个参数和M-n的一样。即可以输入M-5也可以输入C-u 5来重复执行后面的指令5次。但是不像M-n那样,C-u可以不跟参数来重复执行指令。没有参数时,C-u执行后面的指令4次。如果输入C-u C-u,会执行16次指令。这样你可以重复输入C-u来让指令执行多次:1664256等等。【2

[2] Most often, you'll use C-u as we've described here. However, it doesn't always work as a multiplier; sometimes C-u modifies the command's function. Later in this chapter, you'll see one such case. However, if you're doing something where a multiplier makes sense, C-u is almost certain to work.
2】更多时候你会使用C-u。然而,它不总是以叠加的方式工作。有时C-u会改变指令的功能。在本章的后部你会看到一个这样的情况。然而,如果做一些叠加器可以发挥作用时,C-u就会按这种方式工作。

2.1.4 Centering the Display
2.1.4
居中显示

C-l, the recenter command, puts the current line in the center of the window vertically. This feature is useful if you're typing at the bottom or the top of the display. Typing C-l quickly moves the material that you care about to the middle of the display, where it is easier to see the full context.
  C-l,
居中显示指令,将当前行按垂直方向显示在正中间.当你在显示区的上缘或下缘编辑时,这个功能就很有用.输入C-l后迅速将你关心资料移动到显示区中间,这样就比较容易看清上下文了.

C-l also redraws the display, if for any reason it appears obscured or contains random characters. This doesn't happen as often as it used to when we used terminals, but it can be a handy thing to know about, especially if you find yourself using Emacs remotely in a terminal interface.
   
由于某种原因,显示内容被遮盖或者包括乱码,C-l也会重绘显示区.但是在用终端时就不会有这种功能,但是这是个比较方便的快捷键还是应该知道的,尤其是在远程使用Emacs.(感觉像刷新功能).

Table 2-2 lists cursor movement commands. If the command is mnemonic, the word to remember is given in italics.
2-2 列出光标移动指令.如果指令是便于记忆的,助记单词会以斜体形式给出.


2.1.5 Emacs Commands and Your Keyboard
2.1.5 Emacs
指令和你的键盘

You can access many Emacs commands by pressing standard keys on your keyboard, such as PageDown (to scroll down one screen) or Home (to go to the beginning of a buffer). Figure 2-4 shows a sample keyboard layout and what the keys do. Your keys may be in a slightly different place, but if you have a key with the same or a similar name, it should work. We say "should" because there are situations in which the keys won't work—for example, if you use Emacs on a remote machine. We recommend that you also learn the standard Emacs commands; they work on any keyboard, and they are often easier to reach once you learn them.
   
可以通过标准键盘上处理很多Emacs的指令,比如PageDown(下翻页)Home(跳到缓冲区开始位置).2-4显示一个键盘的布局以及键的功能.你的键位置或许有些微区别,如果有的键具有相同的或相似的名字,就应该可以工作.之所以说"应该"是因为有些情况下键不能工作,比如:你在一台远程主机上运行Emacs.我们建议你学习标准Emacs指令;他们可以在任何键盘上工作,并且你一旦学会,它们也比较容易够到.

Figure 2-4. Emacs commands and your keyboard

阅读(284) | 评论(0) | 转发(0) |
0

上一篇:学习GNU Emacs 3rd 2.1移动光标(上)

下一篇:没有了

给主人留下些什么吧!~~