Set emacs "Meta" key to be the mac ⌘ key
14,605
Solution 1
This is what I have in my .emacs
file:
;;; I prefer cmd key for meta
(setq mac-option-key-is-meta nil
mac-command-key-is-meta t
mac-command-modifier 'meta
mac-option-modifier 'none)
(If you're unfamiliar, just add these lines to the file ~/.emacs
(or create it if it doesn't exist), and restart Emacs.)
Solution 2
There is a setting that can be put into your .emacs: mac-command-key-is-meta
that you can set to any non-nil value to enable.
Turning this setting on may cause strange characters to be printed, especially if you are running Leopard or higher. In order to correct that, you will need to set set-keyboard-coding-system
to nil in your .emacs config.
Related videos on Youtube
Author by
ash
Updated on September 18, 2022Comments
-
ash over 1 year
My Emacs uses the Mac alt/option key as the meta key. How do I set it to be the ⌘ key?
-
Indradhanush Gupta over 9 yearsAdditionally, if you want your
option
key to behave assuper
, you should setmac-option-modifier 'super
. I find thesuper
key useful as it helps me navigate between my windows. -
user4601931 over 3 years@IndradhanushGupta Extremely old post, but I'm curious... Why do you prefer CMD over option for meta? How do you copy/paste from e.g. a browser into emacs this way? Also, do you not find cmd-d, cmd-w, etc. less ergonomic?
-
Indradhanush Gupta over 3 years@user4601931 Old post indeed. I've since moved to Linux but ergonomics was indeed the primary reason. With cmd-d I had to arch my thumb inwards less vs option-d as cmd was next to the spacebar on both sides. Also, back then coming from a Windows / Linux platform I was inclined to resist the change and make the Mac work as close to my older laptop as possible. I hope that helps. :D Regarding copy-paste from browser, it's been a lot of years, but cmd-c on the browser and then cmd-y on the Emacs window used to work if memory serves correct. :)