Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
Created September 4, 2012 05:22
Show Gist options
  • Save gcmurphy/3616916 to your computer and use it in GitHub Desktop.
Save gcmurphy/3616916 to your computer and use it in GitHub Desktop.
Sublime Text 2 plugin to read out lout the selected text
import sublime, sublime_plugin
import subprocess, threading
def _run(cmd, args):
subprocess.call([cmd, args])
class SpeakCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
if not region.empty():
cmd = ['espeak', self.view.substr(region)]
threading.Thread(target=_run, args=cmd).start()
@gcmurphy
Copy link
Author

gcmurphy commented Sep 4, 2012

I added this shortcut to the key bindings:

{ "keys": ["shift+alt+v"], "command": "speak" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment