https://github.com/atom/atom-keymap/blob/b33eaa8cd1b30d4aee7a0749fcef8281aff0a428/src/helpers.coffee#L226