d$
Delete till the end of current line and copy deleted content to clipboard.

Script key: Delete till the end of current line and copy deleted content to clipboard.

Posted by Med0paW

Install

Details

Label d$
Voice Over Delete till the end of current line and copy deleted content to clipboard.
Script
// Script keys run short Javascripts
// For documentation and examples, visit:
// http://help.agiletortoise.com

var pos = getSelectedRange()[0];
var line_range = getSelectedLineRange();
var end = line_range[0] + line_range[1];
var total_end = getText().length;
if (end != total_end) {
  end -= 1;
}

var t = getText();
var pre = t.slice(0, pos);
var mid = t.slice(pos, end);
var suf = t.slice(end);

setClipboard(mid);

var new_text = pre + suf;
var new_pos = pos;
setText(new_text);
setSelectedRange(new_pos);

Advanced

Keyboard shortcut None
Hide key Yes

Discussion

comments powered by Disqus