Prevent higher-specificity keymap from overriding global/root keymap


#1

I have a keymap like

"body":
  "cmd-l": "custom:do-something"

But other plugins may override it by having their own map like

"body .something.more-specific":
  "cmd-l": "plugin:do-something-else"

I don’t want to have to write a keymap for every higher-specificity selector that a plugin creates. How do I prevent the global command from being overridden, so that I only have to write it once, so that it will always do exactly what I want?


#2

I don’t believe that a feature analogous to !important has been implemented for Atom’s keymaps, but the rest of the system works on the same strategy as CSS. It’s kind of annoying, but you could do something like body.platform-win32.file-icons-colored atom-workspace.workspace.theme-firewatch-green-syntax using the classes on the outermost elements of the DOM to increase the specificity of your keybindings beyond a point that’s reasonable for a package.


#3

Well, I knew that, but then that means I have to write a bunch of selectors so that I can make the command work everywhere.