Skip to content

Instantly share code, notes, and snippets.

@jimbojsb
Created March 7, 2012 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimbojsb/1990186 to your computer and use it in GitHub Desktop.
Save jimbojsb/1990186 to your computer and use it in GitHub Desktop.
PHPMate for Sublime Text 2
import sublime, sublime_plugin
from subprocess import Popen, PIPE, STDOUT
class RunPhpCommand(sublime_plugin.TextCommand):
def run(self, edit):
content = self.view.substr(sublime.Region(0, self.view.size()))
php = Popen(['/usr/local/bin/php'], stdout=PIPE, stdin=PIPE)
php.stdin.write(content)
output = php.communicate()[0]
newtab = self.view.window().new_file()
newtab.insert(edit, 0, output)
@jimbojsb
Copy link
Author

jimbojsb commented Mar 7, 2012

Create a new plugin and use this as the content of that file. add a key binding if you like:

[
{ "keys": ["ctrl+r"], "command": "run_php"}
]

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