emacs多键击绑定 [英] emacs multi-keystroke binding

查看:157
本文介绍了emacs多键击绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然是EMACS新手,但是当我通过emacs和elisp手册时,我会变得很熟悉。但是现在我坚持下来:



有没有一种简单的方式来绑定regexp样式的输入序列?



例如:函数enlarge-window-horizo​​ntal的默认绑定是Cx {,是否可以将其重新绑定到类似Cx({)+,使得可以通过重复地重复地调用放大窗口水平{字符,而不是释放Ctrl键多次?

解决方案

还有另一种方法来归档你所需要的: p>

第一次要重复上一个命令时,按 Cx z ,之后可以按照 z



这种方法的优点是它适用于您使用的每个命令,而不仅仅是针对特定的命令。



有关其他参考信息,请参见 Ch f


8.11重复命令



许多简单的命令,例如用单键或
Mx COMMAND-NAME 可以通过使用
数字参数来调用它们来重复,该参数用作重复计数(* note Arguments::)。
但是,如果要重复的命令提示输入,或以另一种方式使用
a数字参数,则该方法将无法正常工作。



命令 Cx z (`repeat')提供了另一种方式来重复
Emacs命令多次。此命令重复以前的Emacs
命令,无论如何。重复命令使用与之前使用的相同的
参数;它不会读取每个
时间的新参数。



要重复重复该命令多次,请键入其他 z 的:每个
z 再次重复该命令。键入
a字符以外的重复结束,或者按鼠标键。



例如,假设您键入 Cu 2 0 Cd 删除20
个字符。您可以通过键入 C-x z
z z
,再次重复该命令(包括其参数)三个
以删除总共80个字符。第一个 Cx z 重复该命令一次,每个后续
z 再次重复。



I'm still very new to EMACS, but are getting familiar when i'm going through the emacs and elisp manual. But right now i'm stuck on this:

Is there a simple way to bind input sequences in regexp style?

eg: the default binding for function enlarge-window-horizontally is "C-x {", is it possible to rebind it to something like "C-x ({)+" so that enlarge-window-horizontally can be called repeatedly by repeating "{" character, instead of release Ctrl key multiple times?

解决方案

There is another way to archive what you desire:

The first time you want to repeat the last command, press C-x z, afterwards you may repeat your command as often as desired by just pressing z.

The advantage of this approach is that it works with every command you use and not just for a specific one.

For additional reference here is the output of C-h f

8.11 Repeating a Command

Many simple commands, such as those invoked with a single key or with M-x COMMAND-NAME , can be repeated by invoking them with a numeric argument that serves as a repeat count (*note Arguments::). However, if the command you want to repeat prompts for input, or uses a numeric argument in another way, that method won't work.

The command C-x z (`repeat') provides another way to repeat an Emacs command many times. This command repeats the previous Emacs command, whatever that was. Repeating a command uses the same arguments that were used before; it does not read new arguments each time.

To repeat the command more than once, type additional z's: each z repeats the command one more time. Repetition ends when you type a character other than z, or press a mouse button.

For example, suppose you type C-u 2 0 C-d to delete 20 characters. You can repeat that command (including its argument) three additional times, to delete a total of 80 characters, by typing C-x z z z. The first C-x z repeats the command once, and each subsequent z repeats it once again.

这篇关于emacs多键击绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆