Hi,
I am trying to set up sublime text 2 ( MacOS Yosemite) to run selected lines of a .srp file ( serpent codes). Serpent is A Real-Time Language for Music and Animation: https://www.cs.cmu.edu/~music/aura/serpent-info.htm.
The files are basically .srp files that are excuated using the command : serpent64 sample.srp. So the following sublime-build file works fine.
{
"cmd": ["/Users/csarami/bin/serpent64", "${file}"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.serpent64"
}
I used the plugin mentioned here:
import sublime, sublime_plugin
class ExecuteSelectedCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if not region.empty():
with open('/a/temporary/file', 'w') as f:
f.write(self.view.substr(region))
self.view.window().run_command('build')
break
However, above plugin builds the full document and not the selected region. As a newbie I used the page below to create the plugin. I created the file containing the region, however, it builds the whole file.
http://sublimetext.info/docs/en/extensibility/plugins.html
Any help would be greatly appreciated.
CS