Keybindings not working in Coding mode


#1

Hi,

I’m new to Atom. I switched from emacs.
At first I wanted create some keybindings. I want to switch between tabs with Alt-left and Alt-right but I don’t get this correctly to work.
My keymap at this section:

‘body’: {
‘alt-left ^alt’: ‘unset!’
‘alt-left’: ‘pane:show-previous-item’
‘alt-right ^alt’: ‘unset!’
‘alt-right’: ‘pane:show-next-item’
}

When I hit the keys, the tabs are not switching as long as I’m on a code file. If I for example on the settings tab, the binding works. When I open the keybinding resolver, I see that the binding gets hit.
What I have to change to get this work?


#2

Try this:

'atom-text-editor':
  'alt-left': 'unset!'
  'alt-right': 'unset!'
'body':
  'alt-left': 'pane:show-previous-item'
  'alt-right': 'pane:show-next-item'

The existing keybindings are working on the selector atom-workspace atom-text-editor. So we can tell atom-text-editor to ignore those previous keybindings and allow the key press event to bubble up to the body element. Otherwise, the child element takes precedence as it is more specific by definition.