Changing the Keymap for Tree View:Toggle?


I’m getting started with customizing the Atom Editor and have gotten stumped attempting to change the key mapping for Tree View:Toggle.

I put this in my user keycap.cson file:

     'ctrl-t': 'Tree View:Toggle'```

But it doesn't work.

Looking at Preferences->Keybindings I see it listed as I'd expect:

```ctrl-t   Tree View:Toggle    User    .editor```

What did I do wrong?


I checked the Keybinding Resolver (very clever, I just learned about using cmd-.). I see that my keybinding is firing and goes first above the editor:transpose command from the base.json keycap. So it seems like I’m on the right track, but still missing something.


The command is tree-view:toggle



Even with

     'ctrl-t': 'Tree View:Toggle'

Keyboard Resolver showed it as firing.

     'ctrl-t': 'tree-view:toggle'

fires, too. But neither work.

Is ‘.editor’ the correct scope?


If you look at the screenshot, the scope that the standard keymap uses is .platform-darwin. Have you tried using that?


Yes. And that doesn’t work. It doesn’t even trigger in Keyboard Resolver.


Check this post for links to information on keymap cascade order:

And search on the various keymap topics here. I’m certain you’ll figure it out.


For all who search a working solution, here are my lines:

'.platform-win32 atom-text-editor:not([mini])':
  'alt-q': 'tree-view:toggle'
'.platform-linux atom-text-editor:not([mini])':
  'alt-q': 'tree-view:toggle'
'.platform-darwin atom-text-editor:not([mini])':
  'alt-q': 'tree-view:toggle'

Important: If you have an error or typo someone else in the keymap.cson the whole things are broken.


@jensklose solution worked for me. Thanks!

A minor thing, when I toggle the Tree View, once it appears, it is set as an active panel, not panel with code.

Does anybody know, is there a way to toggle the Tree View without making it active? Like clicking on the menu bar option does currently. I would like to keep typing code after toggling.