Created
October 11, 2013 16:13
-
-
Save neurobashing/6937584 to your computer and use it in GitHub Desktop.
Open the current selection in Dash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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