Cut Entire Line


#1

In a lot of editors, the ability to cut an entire line is supported by CTRL/CMD+X, but only when no characters are highlighted. I’ve looked at the keybindings and at the moment the action for CMD+X on my mac is core:cut, which I suppose only works when there are characters selected. This would be another little productivity bonus :smile:


#2

The quickest way I’ve found to do this is ⌘+L to highlight a line, then just ⌘+X. Granted, that’s 2 combinations to type, but fairly quick.

I’ve noticed that ⌘+X when no characters are selected just does a forward delete (without adding the letter to the clipboard). I don’t know if that is intentional or not…


#3

I think you may like this:


#4

CTRL+k cuts a line, and it puts it into the global clipboard (as opposed to the app specific one that CTRL+k uses elsewhere on OS X).


#5

I wonder if they will start merging some of these features or making them default to the browser because it seems like this functionality should be default.


#6

Funny how they already have the code for it in their doco
https://atom.io/docs/v0.194.0/behind-atom-keymaps-in-depth

atom.commands.add 'atom-text-editor', 'custom:cut-line', ->
  editor = atom.workspace.getActiveTextEditor()
  editor.selectLinesContainingCursors()
  editor.cutSelectedText()

Can they just add this easily.


#7

you can use control+shift+k to cut which ever line your curser is on.


#9

Hahahaha too funny.