Disable default keybindings


#1

I’ve some issues deactivating/overwriting default keybindings.
For instance there is a Keybinding cmd+e (search with selection). Now I want to use cmd+e cmd+up to create a new pane. This doesn’t work due to the search window which will be opened first.

Any suggestions?


Disable keybindings for core packages
#2

:+1:

cmd-< is assigned to editor:scroll-to-cursor

This is my shortcut to cycle through application windows on Mac OS X.

How can I disable the default Atom keybinding?


#3

+1 for removing default cmd-<-binding

You can remove the cmd-< from the Contents/Resources/app/keymaps/darwin.json. But i think should be also fixed in the upsteam since this is a global / default OSX keybinding.


#4

More generally, is there a way to disable the built-in keybindings? Something akin to mapping it to <Nop> in vim?


InvalidStateError when disabling default key binding
#5

I’m facing the same issue. Another possible solution would be to make it possible to force a binding selector.
Similar to !important in CSS. This would simply prefer that selector even if it is less specific than others.


#6

I tried to disable a shortcut in my keymap.csonfile with

'.editor':
  'alt-F': null

unsuccessfully. I’d consider this an intuitive syntax for disabling keybindings though.


#7

+1 for removing default keybind.
I dont have English keyboard layout and some default keybinds are just weird :slight_smile:


#8

Same here. Please add it fast, otherwise atom is pretty unusable for me.


#9

Im facing the same situation.

Im going looking for a solution, or keep using st3.

Please, fix that.

Tank you very much.


#10

I discovered that if you modify atom.keymap.keyBindings, the results take effect immediately. So, you can put a function in your init.coffee that finds the offending keyBinding, and filters it out of the array. You can use [].slice, [].filter, _.difference…

Try it, and post here if you’re successful. The one thing to watch out for is that init.coffee is run every time you open a window, so you might want to make sure it only runs once - or else you might get unexpected results.


#11

+1 for removing the default cmd-< binding

I managed to remove the keymap by adding this code to ~/.atom/init.js

var remove = ['cmd-<', 'alt-d'];
atom.keymap.keyBindings = atom.keymap.keyBindings.filter(function (binding, i) {
    return remove.indexOf(binding.keystroke) == -1;
});

#12

A simpler way to disable any default keybinding is the following:

  1. Open Atom
  2. Open Settings
  3. Click the Keybindings tab at the top (see Screenshot below)
  4. Type in the keymapping you want to disable and press RETURN to search
  5. Click the little clipboard icon next to the keymapping to copy it
  6. Open your custom keymappings file by selecting Atom > Open Your Keymap
  7. Paste in the keymap and delete the command, but not the quotes

Screenshot:

Here is how it looks to disable the cmd-< binding:

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

If you want to override the default keybinding instead of disable it … simply put whatever command you want in the quotes instead.


#13

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?


#14

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


#15

Sadly this did not fix it. :frowning:


#16

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.


#17

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.


#18

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.


#19

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?


#20

Ok, I just figured it out:

'alt-d': 'native!'


Default "alt-g" key binding blocks "@" character on Swiss German keyboards
Fast window switch doesn't work