Action

Trim trailing Whitespace

Posted by log0ff, Last update 19 days ago

Remove whitespace characters (spaces, tabs, line feeds) at end of each line of selection.

Definition of whitespace:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#white_space

Steps

  • script

    // trim trailing whitespace 
    // on each line from selection
    
    editor.setSelectedText(
    	editor.getSelectedText()
    		.split("\n")
    		.map((l) => l.trimEnd())
    		.join("\n")
    );
    

Options

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