Skip to content

Instantly share code, notes, and snippets.

@mbijon
Forked from florinel-chis/komodo_php_beautifier
Created February 24, 2016 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbijon/3837b9a4d7406dfd4b9b to your computer and use it in GitHub Desktop.
Save mbijon/3837b9a4d7406dfd4b9b 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