在 emacs 中避免重叠的键绑定? [英] Avoiding overlapped keybindings in emacs?

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

问题描述

我已经进行了一些搜索,但无法完全找到我要找的东西,所以我想我会问.然而,这可能是由于没有使用正确的术语.

我是 emacs 的新手,已经使用 vim 八年左右,但我真的需要一个编辑器,我可以根据自己的意愿进行修改,所以我正在转换.现在在 vim 中有一个引导键,您可以定义它以避免与各种扩展的重叠绑定.在 emacs 中,应该只为用户留出和弦,但各种模式不坚持这一点.在 emacs 中有没有办法确保我的自定义绑定不会与 vim 前导键重叠?我问的原因是我想保持我的绑定理智.

解决方案

手册详细说明了约定:

Chig (elisp) 键绑定约定 RET

为最终用户保留的序列是:

  • 抄送用于任何(未修改的)大写或小写字母:[A-Za-z]
  • 功能键 F5F6F7F8F9(再次,没有修饰键)

我建议使用这些序列中最简单的作为前缀绑定,因为您可以使用任意键跟随它们,为您提供大量选项.

我喜欢的其他人的建议是,如果您不经常使用 suspend-frame,请取消绑定 C-z,因为这会打开另一个方便的前缀.

当然,如果您为您的操作系统设置了 Super 和 Hyper 修饰键键盘,您可能会获得比您可以找到的用途更方便的序列.对于许多拥有许多现代键盘上的附加修饰键的人来说,这是一个非常合理的选择.

最后,key-chord 库是一种非常流行的创建新的方便且无冲突的方式通过使用一起或快速连续键入的(未修改的)键对(或单个键点击两次)进行绑定.根据我的经验,这非常有效,尽管您显然必须非常小心以避免可能自然发生的绑定序列.

I have done some searching around and can not quite find what I am looking for so I figured I would ask. This could be due to not using the right terms however.

I am new to emacs, having used vim for eight years or so, but I really need an editor I can morph to my will so I am switching. Now in vim there is a leader key you can define to avoid overlapping bindings with various extensions. In emacs there are supposed to be chords set aside for the user only but various modes do not adhere to this. Is there a way in emacs I can ensure my custom bindings do not overlap similar to the vim leader key? The reason I ask is I want to keep my bindings sane.

解决方案

The manual details the conventions:

C-hig (elisp) Key Binding Conventions RET

Sequences reserved for the end-user are:

  • C-c<letter> for any (un-modified) upper or lower case letter: [A-Za-z]
  • Function keys F5, F6, F7, F8, F9 (again, without modifier keys)

I recommend using the easiest of these sequences as prefix bindings, as you can then follow them with any key at all, giving you a large number of options.

Someone else's recommendation that I liked was to unbind C-z if you don't commonly use suspend-frame, as that opens up another convenient prefix.

Of course, if you set up Super and Hyper modifier keys for your OS & keyboard, you would likely gain more convenient sequences than you could find uses for. This is a very reasonable option for many people with the additional modifier keys found on many modern keyboards.

Finally, the key-chord library is quite a popular way of creating new convenient and non-conflicting bindings by using pairs of (un-modified) keys typed together or in quick succession (or a single key tapped twice). This works very well in my experience, although you obviously have to be very careful to avoid binding sequences which might occur naturally.

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

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