spacemacs/layers/+os/osx
Aaron Culich 2215ffe68d change osx-command-as default for ⌘ to hyper instead of super
The purpose of this PR is to set the default for ⌘ to `hyper' and to provide the
function `kbd-mac-command` to replace `kbd' when defining keybindings for ⌘ in
case someone decides to explicitly set osx-command-as to `super' or `alt'.

There are problems setting osx-command-as to `alt' and `super',
so we use `hyper' as a default instead because, for example:
  - Using `alt':   Command-x or Command-m inserts, respectively: × µ
  - Using `super': Control-Command-f produces keycode: <C-s-268632078>
Setting to `hyper' seems to avoid both types of the above problems.
Also, while it is possible, it is not recommended to set to `meta'
since standard OSX shortcuts would overshadow important keys such
as M-x.

Two other small changes include:

  - Commenting out the code that defines <C-s-268632078> (C-s-f) since it is
    unnecessary if we use `hyper' as the default; and if we really want to use
    `super' then we should figure out how to solve the weird keycode issue.

  - add keybinding for ⌘` (Command-backtick) to `other-window'.
    Emacs usually swallows this keystroke, so other-window basically restores
    the default behavior that most Mac OSX users would expect.
2017-05-14 21:54:06 -04:00
..
img
config.el change osx-command-as default for ⌘ to hyper instead of super 2017-05-14 21:54:06 -04:00
funcs.el Bump year in copyright headers 2017-01-05 23:08:17 -05:00
keybindings.el change osx-command-as default for ⌘ to hyper instead of super 2017-05-14 21:54:06 -04:00
packages.el Bump year in copyright headers 2017-01-05 23:08:17 -05:00
README.org change osx-command-as default for ⌘ to hyper instead of super 2017-05-14 21:54:06 -04:00

OSX layer

/TakeV/spacemacs/media/commit/2215ffe68d36c5a2f80b0830e2f7f19bb7803ce2/layers/+os/osx/img/apple.png

Description

Spacemacs is not just emacs+vim. It can have OSX keybindings too! This layer globally defines common OSX keybindings. is set to hyper and is set to meta. Aside from that, there's nothing much, really.

While in dired this layer will try to use gls instead of ls.

Philosophy

While this layer enables common OSX bindings, it does not implement OSX navigation keybindings. Spacemacs is meant to be used with evil, and we encourage you to do so :)

Install

Layer

Layer has been updated for new config variables. The variable osx-use-option-as-meta is still available for backwards compatibility and will take precedence if set.

To use this configuration layer, add it to your ~/.spacemacs. You will need to add osx to the existing dotspacemacs-configuration-layers list in this file. The different modifier keys can be set as follows:

  (setq-defaults dotspacemacs-configuration-layers '(
     (osx :variables osx-command-as       'hyper
                     osx-option-as        'meta
                     osx-control-as       'control
                     osx-function-as      'none
                     osx-right-command-as 'left
                     osx-right-option-as  'left
                     osx-right-control-as 'left))

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 none. Setting nil for modifiers will leave the left modifiers as emacs default.

Use with non-US keyboard layouts

If you need the key to type common characters such as {[]}~ which is usual for e.g. Finnish and Swedish keyboard layouts, you'll probably want to leave the key unchanged by setting the osx-option-as variable to none:

  (setq-default dotspacemacs-configuration-layers '(
     (osx :variables osx-option-as 'none)))

If you have problem entering symbols that are behind the key you may want to set the variables as follows. This will allow you to use the right key to write symbols. The left key can be used as the Meta key.

  (setq-default dotspacemacs-configuration-layers '(
     (osx :variables osx-option-as 'meta
                     osx-right-option-as 'none)))

Define words using OS X Dictionary

This layer by default enables defining words under point SPC x w d using OS X Dictionary. In some cases you might want to manually setup dictionary to use. For example,

  (setq-default dotspacemacs-configuration-layers '(
     (osx :variables osx-dictionary-dictionary-choice "English")))

To get the list of available dictionaries call osx/list-available-dictionaries function.

You can disable it by setting osx-use-dictionary-app variable to nil:

  (setq-default dotspacemacs-configuration-layers '(
     (osx :variables osx-use-dictionary-app nil)))

Coreutils

To get gls install coreutils homebrew:

  brew install coreutils

Key Bindings

Key Binding Description
⌘ = Scale up text
⌘ - Scale down text
⌘ q Quit
⌘ v Paste
⌘ c Copy
⌘ x Cut
⌘ a Select all
⌘ w Close window
⌘ W Close frame
⌘ n New frame
⌘ ` Other frame
⌘ z Undo
⌘ Z Redo
⌃ ⌘ f Toggle fullscreen
SPC x w d Define word under the point

Future Work

  • Allow user to choose from either hyper or super as . This is an option that is supported cross-platform.
  • Configurable option to keep the OSX and spacemacs clipboards separate