Skip to content

Instantly share code, notes, and snippets.

@neurobashing
Created October 11, 2013 16:13
Show Gist options
  • Save neurobashing/6937584 to your computer and use it in GitHub Desktop.
Save neurobashing/6937584 to your computer and use it in GitHub Desktop.
Open the current selection in Dash
var langs = {
JavaScript: "js:",
Python: "py:",
'Node.js': "node:"
}
komodo.assertMacroVersion(3);
if (komodo.view) { komodo.view.setFocus(); }
var thislang = ko.views.manager.currentView.koDoc.language
var selection = ko.views.manager.currentView.scimoz.selText
var runSvc = Components.classes["@activestate.com/koRunService;1"].
createInstance(Components.interfaces.koIRunService);
var command = "/usr/bin/open dash://"+ langs[thislang] + selection ;
var process = runSvc.RunAndNotify(command /* command */,
'/tmp' /* cwd */,
"" /* environment settings */,
"" /* stdin input */);
var retval = process.wait(-1); /* wait till the process is done */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment