Disable default keybindings

This seems to not work with overriding core keybindings:

'.editor':
'alt-cmd-[': 'editor:outdent-selected-rows'
  
'.workspace .editor:not(.mini)':
  'alt-cmd-[': 'editor:outdent-selected-rows'

Or do I have problems because my keyboard is set to german?

Try adding .platform-darwin at the start of the selector to make the selector more specific (I think) …

1 Like

Sadly this did not fix it. :frowning:

I did the following in my keymap.cson:

'.workspace .editor:not(.mini)':
  'alt-cmd-[': 'pane:show-previous-item'

This successfully overrode the built-in command. I’ll try setting my keyboard to German next.

1 Like

It looks like it may well be because of the German keyboard. On my US keyboard when I use the German keymapping in System Settings, the [ character is mapped to alt-5. So with this mapping, I was obviously unable to double-press the alt modifier. Not sure how the US keyboard with the German keymapping makes things different, if at all.

Okay, I did not know that the US keyboard had this so different, especially since cmd+alt+6 works works indenting. I used the 5 instead of [ and it works.

On my keyboard, alt-d is mapped to : (colon). By default, the keybinding would be editor:delete-to-end-of-word. When I disable the keybinding with your suggestion, it doesn’t perform the previous keybinding, but it doesn’t insert a colon either. Is there any way I can get the colon inserted?

Ok, I just figured it out:

'alt-d': 'native!'

17 Likes

Awesome! I learned something too :sunglasses:

If you add document.body.id = 'custom-precedence' to your init.coffee file, you can then use the #custom-precedence ID precedence (winner!) in your keymap.cson file.

3 Likes

Works for me - thanks!

1 Like

@bjmiller FYI, I actually did something similar in my jumpy package. I _.clone it and remove all but my custom maps. I had issues with the timing ones ‘g g’ in vim-mode for example. It’s a little dirty, so I’ll revisit this later, but I haven’t heard of any complaints yet… Also newly applied mappings could cause issues, I have a todo item to fix that a bit.

Just learned that it’s better to use unset! to do this:

'.workspace .editor:not(.mini), .workspace':
  'cmd-<': 'unset!'

Using an empty String causes an error with v0.120.0 of Atom (see here)

6 Likes

@nwinkler good to know. FYI: I also tested to make sure the other method of removing the whole entry (ie, both lines in your code above) from keymaps works as well in 0.120.0. It still does.

@lukasoppermann did you find a workaround?

I have a similar problem with french keyboard and nothing listed here works. (altgr + ‘)’ is folding code, supposed to be a closing braquet char).

Problem is reported there: https://github.com/atom/atom-keymap/issues/35 but don’t look very active.

To fix a problem about keybinding, open the “Keybinding Resolver” (Packages > Keybinding Resolver > Toggle

Use your shortcut, for example on french keyboard altgr + ')'
The “Keybinding Resolver” show : ctrl-alt-=

Add in your Keymap file :

'.editor':
    'ctrl-alt-=': 'unset!'
2 Likes

I am trying to make delete line work via cmd-delete.

'.workspace .editor':
  'cmd-delete': 'unset!'

'.platform-darwin .editor':
  'cmd-delete': 'editor:delete-line'

No such luck as it is not working.

This is what finally worked for me https://github.com/atom/atom-keymap/issues/9

'.workspace .editor':
  'cmd-backspace': 'unset!'
  'cmd-delete': 'unset!'
  'cmd-backspace': 'editor:delete-line'
  'cmd-delete': 'editor:delete-line'

Thanks. This helped me. I was getting error with empty value too.

With azerty (french keyboard) the ] is mapped to ctrl-alt-[

I edited my keymap file adding these lines:

'atom-workspace atom-text-editor:not([mini])':
  'ctrl-alt-[': 'unset!'
3 Likes