Action

Smart Cut

Posted by pseudometa, Last update 11 months ago

Cut selected text like normal cmd + x. If no text is selected, will cut the current line instead (similar to the behavior in code editors).

Steps

  • script

    text = editor.getSelectedText();
    
    if (!text) {
    	const [st, len] = editor.getSelectedLineRange();
    	editor.setSelectedRange(st - 1, len + 1);
    	text = editor.getSelectedText().trim();
    }
    
    editor.setSelectedText("");
    app.setClipboard(text);
    

Options

  • After Success Default
    Notification Error
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.