Unbind plugin keybinding


Hi! I am currently working on a atom plugin but for it to work I need to unbind some keys (preferable from within my plugin).

In particular, I am trying to unbind a key from vim-mode . When I just add my keybinding to the same key, the vim-mode one gets executed first and it never reaches my handler.

The key binding resolver is telling me that the vim-mode one is green and my custom one is grey.

How can I unbind a certain keybinding?


atom.keymaps gives you access to the key bindings. I think you could wait for a match with onDidMatchBinding, then prevent the default behavior and do your thing.

Is this for a package? Just out of curiosity, why would you shortcut another package binding? Would not be better to let the user just pick a new binding and put that in the local keymap?


I agree with @b3by, unbinding another package’s keybindings is a great way to cause the Atom team to have to field Issues like these:

So please consider other alternatives :grinning:


hi and thanks for the answer! To give a little more info, the plugin is supposed to work inside vim modes command mode, however most keys that seem intuitive are already taken and the key event doesn’t even propagate until my handler.

I will definitely let the user set his own keybinding but in anyway, this helps me to understand the keymapping system a lot better.

I will give atom.keymaps a try and report back if I could make it work! Thanks a lot.


hrm, the event that onDidMatchBinding receives doesn’t seem to allow for preventDefault. It however allowed me to manually bind my keyboard event even though the vim-mode one still fires and makes it do it’s thing.