简体   繁体   English

如何将Mx映射到emacs 24中的“`”键(Mac OS X Lion)

[英]How do I map M-x to “`” key in emacs 24 (Mac OS X Lion)

I've downloaded Emacs 24 pretest for Mac OS X and using Prelude + evil kit. 我已经为Mac OS X下载了Emacs 24预测试并使用了Prelude + evil kit。 I am coming from vim background and find that Mx is too slow and painful to use. 我是从vim背景来的,发现Mx太慢而且使用起来很痛苦。 Is there any way to map Mx key to ` key that is near the ESC key? 有没有办法将Mx键映射到ESC键附近的键? Thanks. 谢谢。

(global-set-key (kbd "`") 'execute-extended-command)

find that Mx is too slow and painful to use 发现Mx太慢而且使用起来很痛苦

I'm a touch-typist and I happen to think the same and I also think that, in addition, all the Cx shortcuts are very hard to do too. 我是一个触摸打字员,我碰巧也是这么认为,而且我也认为,此外,所有的Cx快捷方式都很难做到。

Is there any way to map Mx key to ` key that is near the ESC key? 有没有办法将Mx键映射到ESC键附近的键?

I would say that the ESC key is not really a "close" key: your left pinky has to travel a lot to get there (you either need to move your entire hand, which is not efficient, or you need to "stretch" your fingers). 我会说ESC键不是真正的“关闭”键:你的左小拇指必须经常旅行才能到达那里(你需要移动你的整只手,效率不高,或者你需要“伸展”你的手指)。

What I did, on a QWERTY keyboard, is to remap CX to C-, 我在QWERTY键盘上做的是将CX重新映射到C-,

You may want to do something similar: in my opinion it really helps. 你可能想做类似的事情:在我看来它确实有帮助。 So maybe mapping Cx to C-, and Mx to M-, would help? 那么将Cx映射到C-, M-,Mx映射到M-,会有帮助吗?

You can do this like the other answer suggested by directly setting a global key: 您可以像直接设置全局密钥建议的其他答案一样执行此操作:

(define-key global-map [(control ,)] ctl-x-map)

or you can define your own minor-mode where you put all your mappings and then turn that minor mode on (I learned that here on SO): 或者你可以定义你自己的次要模式,你把所有的映射,然后打开那个次要模式(我在这里了解到这一点):

(define-key my-keys-minor-mode-map (kbd "C-,") ctl-x-map)
(define-key my-keys-minor-mode-map (kbd "M-,") 'execute-extended-command)
... put more mappings here ...

(define-minor-mode my-keys-minor-mode
  "A minor mode so that my key settings override annoying major modes."
  t " my-keys" 'my-keys-minor-mode-map)

(my-keys-minor-mode 1)

Or course you "lose" the previous mappings to C-, and M-, but IMHO it's totally worth it. 或者当然,你“失去”以前的映射到C-和M-,但恕我直言,这是完全值得的。

You probably want to read user scottfrazer 's great answer and explanation here (that's what I followed to create my own key minor-mode in my .emacs file): 你可能想在这里阅读用户scottfrazer的好答案和解释(这就是我在.emacs文件中创建自己的密钥小模式时所遵循的):

Globally override key binding in Emacs 全局覆盖Emacs中的键绑定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM