macos 命令键作为 OS X Terminal.app 中的 Meta 键
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1856437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Command key as Meta key in OS X Terminal.app
提问by subopt
When i unckeck the 'Use option as meta key'box in Settings, and then do Cmd+F(which i want to mean Meta+Ffor forward-word in bash) Terminal gives me a 'find word' popup, which isn't what i want. What i really want is for my Terminals to behave just like an xterm w.r.t. the key bindings. Is there any way to disable this popup and its binding?
当我取消选中“设置”中的“使用选项作为元键”框,然后执行Cmd+ F(我想在 bash 中表示Meta+F表示前向词)时,终端会弹出一个“查找词”弹出窗口,这不是我想要的. 我真正想要的是让我的终端表现得像一个 xterm wrt 键绑定。有没有办法禁用这个弹出窗口及其绑定?
I know i could just use actual xterms, but for a variety of reasons i want to use Terminal.
我知道我可以只使用实际的 xterms,但出于各种原因我想使用终端。
thanks in advance, Eric
提前致谢,埃里克
回答by Ned Deily
The option as meta key
selection has no effect on the Command(Apple) key. If option as meta key
is selected, then the Optionkey acts as a Metakey in bash
and elsewhere; just press Option+F. If you de-select it, there is no Metakey. (In either case, some command line programs may recognize the traditional ESC+char sequence as Metachar.)
该option as meta key
选择对没有效果命令(Apple)的关键。如果option as meta key
被选中,则Option键在其他地方充当Meta键bash
;只需按Option+ F。如果取消选择它,则没有Meta键。(在任何一种情况下,一些命令行程序可能会将传统的ESC+char 序列识别为元字符。)
If you are running OS X 10.6 (Snow Leopard), Apple supplies a built-in way to change the meaning of the keyboard modifier keys, including Commandand Option. Go to System Preferences -> Keyboard
and click on the Modifier Key...
button. A panel will appear that allows you to, for instance, swap the meaning of the Optionand Commandkeys. But, be warned that this is a global option and will apply everywhereon OS X and could lead to some major confusion. If you do that, you will be swimming upstream as noted here. You will likely be best served long-term by getting used to the OS X default of using the Optionkey as Metaand, if necessary, restoring application defaults (for Emacs
, say) to follow that convention.
如果您运行的是 OS X 10.6 (Snow Leopard),Apple 提供了一种内置方式来更改键盘修饰键的含义,包括Command和Option。转到System Preferences -> Keyboard
并单击Modifier Key...
按钮。例如,将出现一个面板,允许您交换Option和Command键的含义。但是,请注意,这是一个全局选项,将适用于 OS X 上的任何地方,并可能导致一些重大混乱。如果你这样做,你将像这里提到的那样逆流而上。通过习惯将Option键用作Meta的 OS X 默认设置,您可能会长期获得最佳服务并且,如有必要,恢复应用程序默认值(Emacs
例如)以遵循该约定。
FURTHER EDIT: This blog postand program(untested) might be helpful.
回答by J the anonymous
Just install keyremap4macbook utility from http://pqrs.org/macosx/keyremap4macbook/.
只需从http://pqrs.org/macosx/keyremap4macbook/安装 keyremap4macbook 实用程序。
In the option, you can tweak Terminal.app many ways, not to mention Option to Command_L mapping and vice versa. It has so many handy options that i would say this is a must app for mac user!
在选项中,您可以通过多种方式调整 Terminal.app,更不用说 Option 到 Command_L 映射,反之亦然。它有很多方便的选项,我会说这是 Mac 用户必备的应用程序!
回答by Atlas7
EDIT: I just realised this answer hasn't answered how to customise key mapping for the meta key. I hope however this answer might help others to find the meta key on a Mac though (it took me ages to find the meta key on Mac and this forum just helped me - so posting what I've got here. No harm I guess).
编辑:我刚刚意识到这个答案没有回答如何为元键自定义键映射。然而,我希望这个答案可以帮助其他人在 Mac 上找到元键(我花了很长时间才在 Mac 上找到元键,这个论坛只是帮助了我 - 所以张贴我在这里得到的东西。我猜没有坏处) .
On my Macbook Pro (el capitan), the meta key is by default mapped to the ESCkey.
在我的 Macbook Pro (el capan) 上,元键默认映射到ESC键。
For example, say in emacs editor, to do a M-%
(emacs find and replace), I would do ESC+%
例如,在 emacs 编辑器中说,要做一个M-%
(emacs find and replace),我会做ESC+%
(I've tested this on iTerm2 and Terminal app.)
(我已经在 iTerm2 和终端应用程序上对此进行了测试。)
The answer posted by @NedDeily helped.
@NedDeily 发布的答案有所帮助。