Possible to chain actions together somehow?


#1

In Sublime ctrl-x will cut the whole line in which the cursor is located. Is there a way to mimic this behaviour in Atom?


#2

That’s the beauty of Atom.

Add this code to your init.coffee file:

atom.workspaceView.command 'custom:cutline', ->
  editor = atom.workspace.getActiveEditor()
  editor.selectLine() if not editor.getSelectedText()
  editor.cutSelectedText()

The add this to your keymap.cson file:

'body':
  'cmd-x': 'custom:cutline'

Conditional keybinding behaviour
#3

Beautiful! Thanks! Much appreciated!


#4

I took @AbeEstrada code and added copy and paste functions.