diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 13896307e..760a036f2 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -2068,6 +2068,8 @@ Other: - Fixed key binding issue when Emacs is launched in daemon mode. - Added the default value =H-= (hyper) to =kbd-mac-command= if it's neither: =hyper=, =super= or =alt= (thanks to Binbin Ye) +- Added a layer variable =osx-swap-option-and-command= defaults to =nil= + (thanks to Binbin Ye) **** Pandoc - Fixed =spacemacs/run-pandoc= not to reset =pandoc--local-settings= (thanks to martian-f) diff --git a/layers/+os/osx/README.org b/layers/+os/osx/README.org index e762704c4..d1734466c 100644 --- a/layers/+os/osx/README.org +++ b/layers/+os/osx/README.org @@ -47,13 +47,15 @@ The different modifier keys can be set as follows: osx-function-as nil osx-right-command-as 'left osx-right-option-as 'left - osx-right-control-as 'left)) + osx-right-control-as 'left + osx-swap-option-and-command nil)) #+END_SRC These are also the default values. Setting the right modifier to =left= will equal the left modifier. Allowed values are: =super=, =meta=, =control=, =alt= and =nil=. Setting =nil= for modifiers will leave the left modifiers as emacs default. +Setting =osx-swap-option-and-command= to =t= will swap =command= and =option= key. *** Use with non-US keyboard layouts If you need the ~⌥~ key to type common characters such as ={[]}~= which is usual diff --git a/layers/+os/osx/config.el b/layers/+os/osx/config.el index 5402dae13..9a82325dc 100644 --- a/layers/+os/osx/config.el +++ b/layers/+os/osx/config.el @@ -60,6 +60,9 @@ (defvar osx-use-dictionary-app t "If non nil use osx dictionary app instead of wordnet") +(defvar osx-swap-option-and-command nil + "If non nil swap option key and command key") + ;; Use the OS X Emoji font for Emoticons (when (fboundp 'set-fontset-font) (set-fontset-font "fontset-default" diff --git a/layers/+os/osx/keybindings.el b/layers/+os/osx/keybindings.el index d057b1c04..54a3b1edb 100644 --- a/layers/+os/osx/keybindings.el +++ b/layers/+os/osx/keybindings.el @@ -45,6 +45,9 @@ (when (member key-value allowed-values) (setf (symbol-value internal-var) key-value)))) + (when osx-swap-option-and-command + (cl-rotatef mac-command-modifier mac-option-modifier)) + (defun kbd-mac-command (keys) "Wraps `kbd' function with Mac OSX compatible Command-key (⌘). KEYS should be a string such as \"f\" which will be turned into values