Skip to content

Instantly share code, notes, and snippets.

@florinel-chis
Created October 23, 2012 16:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save florinel-chis/3940072 to your computer and use it in GitHub Desktop.
Save florinel-chis/3940072 to your computer and use it in GitHub Desktop.
Macro for Komodo Edit - PHP Beautifier
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