Plugin to run selected text as script

After installing this plugin you can run the selected text as a Javascript, and the text result will be inserted and selected after the script is run.

  1. Select some text in your document that is Javascript
  2. Edit > Run Command…
  3. Choose the “run script” command

It works with simple JavaScript expressions like:

1 + 2

Or you can define a function and it will be called with the current editor as a parameter.

function (editor) {
    return editor.selectedRange().startNode.type();

This plugin is available (along with others) from FoldingText’s official plugin collection.