Action Directory / Cut Current Line(剪切当前行)

Install

The current line (closest to the cursor) is cut to the clipboard.

Shared by

Script

var line_range = editor.getSelectedLineRange();
var eol = line_range[0] + line_range[1];
if ( editor.getTextInRange( eol - 1, 1 ) === '\n' ) {
  eol = eol - 1;
}

app.setClipboard(editor.getTextInRange(line_range[0],eol-line_range[0]));

editor.replaceTextInRange(line_range[0],eol-line_range[0],null)