Creating a keybinding/command for multiple other commands


I want to create keybindings that executes more than one command, and i was wondering if this was possible on the current version of Atom.
From what i found, this seems to currently be impossible on Atom. But, any topic i found about this issue is very old and probably outdated.
The main thing i found about it is this topic:

In “Izuzak” 's comment, he says this is currently impossible (currently being 2014).

So, is it possible nowadays to create keybindings for multiple commands?

If not, what is currently the best practice for creating commands composed of multiple other commands?

Also, a bit of a wierd question, but is it practical to work with atom as someone who likes to create many such commands? Will i eventually go insane coz of update changes messing up my commands or whatever?


It’s impossible to bind one keybinding to multiple commands, but it’s easy to write new commands that activate other commands. Just put it in your

atom.commands.add "atom-workspace", "custom:two-actions", (evt) ->
  atom.commands.dispatch, "custom:action-one"
  atom.commands.dispatch, "some-package:action-two"

Passing the event through is necessary because events are context-sensitive. In code, you can simulate events in any element you want, but in this case you probably want all triggered events to share the same target element.


just so ill fully understand the syntax, could you write for me the following command:

While in the tree view, if im focused on a file and i press “space”, the file will open in pending mode, but the focus will remain on the tree-view on the same file name.

i currently do it by pressing ‘right’, and then ‘alt+\’. the commands executed are: tree-view:expand-item, tree-view:toggle-focus.

btw, sorry for the late reply.