Command key as Meta key in OS X Terminal.app

谁说我不能喝 提交于 2019-12-02 16:59:53
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 Option key acts as a Meta key in bash and elsewhere; just press Option+F. If you de-select it, there is no Meta key. (In either case, some command line programs may recognize the traditional ESC+char sequence as Meta 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 Command and 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 Option and Command keys. But, be warned that this is a global option and will apply everywhere on 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 Option key as Meta and, if necessary, restoring application defaults (for Emacs, say) to follow that convention.

FURTHER EDIT: This blog post and program (untested) might be helpful.

Just install keyremap4macbook utility from http://pqrs.org/macosx/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!

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).

On my Macbook Pro (el capitan), the meta key is by default mapped to the ESC key.

For example, say in emacs editor, to do a M-% (emacs find and replace), I would do ESC+%

(I've tested this on iTerm2 and Terminal app.)

The answer posted by @NedDeily helped.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!