I want to write a command for Atom that composes two or more pre-existing commands, like "Select Line" and then "Cut". How do I do that?
You can add the following code to your init.coffee
file:
atom.commands.add 'atom-text-editor', 'custom:cut-line', ->
editor = atom.workspace.getActiveTextEditor()
editor.selectLinesContainingCursors()
editor.cutSelectedText()
You can get the code to execute from the source by searching for strings in the command palette. And once you have a command created, you can map a key to it by editing your keymap.cson
file:
'atom-text-editor':
'alt-cmd-z': 'custom:cut-line'