Command key as Meta key in OS X Terminal.app
When i unckeck the 'Use option as meta key' box in Settings, and then do Cmd+F (which i want to mean Meta+F for 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?
I know i could just use actual xterms, but for a variety of reasons i want to use Terminal.
thanks in advance, Eric
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.