简体   繁体   English

有没有一种方法可以将Tab键映射到emacs中的meta?

[英]Is there a way to map the tab key to meta in emacs?

I'm looking to rebind Meta to the tab key in my emacs environment. 我想在我的emacs环境中将Meta重新绑定到tab键。 I've looked around but been unable to find anything other than binding it to command or option , which are slightly better but still not ideal. 我环顾四周,但除了将其绑定到commandoption ,找不到任何其他东西,它们稍好一些,但仍然不理想。

You cannot do this in Emacs alone, you need to modify the keymap in your window system (*nux, Mac, MS Windows). 您不能仅在Emacs中执行此操作,需要在窗口系统(* nux,Mac,MS Windows)中修改键盘映射。

See the similar questions for the reasoning: Mapping Caps Lock to Control from within Emacs on Windows , elisp how to check if Shift key is pressed , and Can I send a keypress to Windows from Emacs? 出于以下原因,请参阅类似的问题: 在Windows的Emacs中将大写锁定映射到控件elisp如何检查是否按下了Shift键 ,并且可以从Emacs向Windows发送按键吗? .

You can make the change in your window system - but it'd be helpful to know what that is... 可以在窗口系统中进行更改 - 但了解它是什么有帮助...

If you use OS X, you can install KeyRemap4MacBook and use a private.xml like this: 如果使用OS X,则可以安装KeyRemap4MacBook并使用如下的private.xml

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>EMACS</appname>
    <equal>org.gnu.Emacs</equal>
  </appdef>
  <item>
    <name>tabtometa</name>
    <identifier>tabtometa</identifier>
    <only>EMACS</only>
    <autogen>__KeyOverlaidModifier__ KeyCode::TAB, KeyCode::OPTION_L, KeyCode::TAB</autogen>
  </item>
</root>

It changes tab to option when held but keeps it as tab when pressed. 按住时将选项卡更改为选项,但按下时将其保留为选项卡。

If you want to use option to insert non-ASCII characters, change OPTION_L to CONTROL_R and use: 如果要使用选项插入非ASCII字符, OPTION_L更改为CONTROL_R并使用:

(setq ns-option-modifier 'nil)
(setq ns-right-control-modifier 'meta)

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

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