Created
March 7, 2012 00:56
-
-
Save jimbojsb/1990186 to your computer and use it in GitHub Desktop.
PHPMate for Sublime Text 2
This file contains 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
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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"}
]