Remapping toggle-buffer-finder


I am brand new to Atom. Just trying to figure out how to do some key remapping.

I would like to remap ctrl-t to fuzzy-finder:toggle-buffer-finder and leave ctrl-p as fuzzy-finder:toggle-file-finder.

Here is my config:

  'ctrl-t': 'fuzzy-finder:toggle-buffer-finder'
  'ctrl-p': 'fuzzy-finder:toggle-file-finder'

For some reason toggle-file-finder still takes control of ctrl-t. Is there a step I am missing? In case it is relevant, I am using the vim-mode plugin.

Related: How do I determine what selector to use?


Have you tried using the Keybinding Resolver (Cmd+. on OS X and Ctrl+. on other platforms)? It will show you what key Atom saw you press and the command that was triggered because of it.


Key Binding Resolver: ctrl-t
âś“ fuzzy-finder:toggle-file-finder .platform-linux
âś• fuzzy-finder:toggle-file-finder .platform-win32

It doesn’t seem to be finding my custom keyboard shortcut at all.


Notice that the selectors for both of those are .platform-*. The selector you gave, atom-workspace, isn’t as specific as they are, so they win. If you replace atom-workspace with .platform-linux, you might have better luck.


How do I learn the hierarchy of selectors and what is higher than another?



In this case however, .atom-workspace and .platform-linux have the same number of classes and no additionaly selectors. Why does moving my keyboard shortcut under .platform-linux work, but not in the other one?

Sorry if this is starting to leave the root of the question. I found the documentation about creating keyboard shortcuts to be lacking.

Thank you.


You weren’t using .atom-workspace, a class which has higher specificity, you were using atom-workspace, an element which has lower specificity.


You are correct. When I move it under .atom-workspace it shows up in the Keybinding Resolver, but my shortcut is at the bottom and grayed out indicating .platform-linux has taken higher priority. Is there chart I can use that shows these orders?


Just add any class to make it more specific.


The class .atom-workspace doesn’t exist and doesn’t match anything. What does following my original suggestion, to use simply .platform-linux do? Because I just tried it and using this:

  'cmd-t': 'custom:open-todo-list'

worked just fine:


It does work, I am just trying to learn how I can figure out what selector to use in the future for other shortcuts.


Maybe I could expand a little on @leedohm’s explanation, @tgrosinger?

Say you have this snippet of HTML:

<div class="foo"></div>

This is a div element of class foo, and they can be matched in CSS in the following two ways:

div { ... }    /* Matches using element name, less specific. */
.foo { ... }   /* Matches using class, more specific. */

In the above case, the first You can also combine the two selectors to make an even more specific selector: { ... } /* Even more specific. */

In the same way, atom-workspace is an element and platform-linux is its class:

<atom-workspace class="platform-linux">...</atom-workspace>

Again, you can use the following three ways, least specific first, most specific last:

atom-workspace { ... }                 /* Least specific */
.platform-linux { ... }                /* More specific */
atom-workspace.platform-linux { ... }  /* Most specific */

Does this clarify?


This is very helpful. Thank you.