Created
October 23, 2012 16:59
-
-
Save florinel-chis/3940072 to your computer and use it in GitHub Desktop.
Macro for Komodo Edit - PHP Beautifier
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
try { | |
if (komodo.view.scintilla) { komodo.view.scintilla.focus(); } | |
var currentPos = komodo.editor.currentPos; | |
var ke = komodo.editor; | |
var file = komodo.interpolate('%F'); | |
var php = komodo.interpolate('%(php)'); | |
var script = "/usr/local/zend/bin/php_beautifier"//this can be changed to the path of php_beautifier, install using PEAR | |
var cmd = script+" --filters='ArrayNested()' "+file; // add options dialog? | |
StatusBar_AddMessage("Beautifying "+file,"editor",5000,true); | |
komodo.doCommand('cmd_save'); | |
ke.beginUndoAction(); | |
komodo.doCommand('cmd_selectAll'); | |
Run_RunEncodedCommand(window, cmd + " {'insertOutput': True}"); | |
ke.gotoPos(currentPos); | |
komodo.doCommand('cmd_cleanLineEndings'); | |
StatusBar_AddMessage("Finished Beautification","editor",5000,true); | |
} catch(e) { alert(e); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment