Nuclide has a bunch of built-in bindings to help you be productive from the keyboard. However, you may want to add your own keybindings for Nuclide commands as well. This is fairly easily done with some CSON editing.

Keymap CSON

To create your own keybinding, you will need to edit your ~/.atom/keymap.cson file. If you aren’t familiar with CSON, it is the CoffeeScript equivalent of JSON.

Here is an example ~/.atom/keymap.cson file:

  'cmd-d': 'editor:delete-line'
  'cmd-home': 'core:move-to-top'
  'cmd-end': 'core:move-to-bottom'
  'cmd-l': 'go-to-line:toggle'

Because CSON is a superset of JSON this could also be written as:

   '.editor:not(.mini)': {
     'cmd-d': 'editor:delete-line',
     'cmd-home': 'core:move-to-top',
     'cmd-end': 'core:move-to-bottom',
     'cmd-l': 'go-to-line:toggle'

It may not be obvious, but each key in the top-level map is a CSS selector. Values are pairs of commands and keybindings that are applicable in an element that matches the CSS selector. The selector .editor:not(.mini) matches an editor in Nuclide that is not used as a single-line input text box. Therefore, when you want to add a keyboard shortcut for an editor, add it to the .editor:not(.mini) map.

Platform Specific Bindings

You can make your bindings platform specific with .platform-xxxxx as part of your CSS selector. For example the Nuclide diff-view CSON looks like this:

'.platform-darwin atom-workspace':
  'alt-cmd-shift-d': 'nuclide-diff-view:open'

'.platform-win32 atom-workspace, .platform-linux atom-workspace':
  'alt-ctrl-shift-d': 'nuclide-diff-view:open'

where .platform-darwin represents macOS, .platform-win32 represents Windows, and .platform-linux represents Linux.