1

ZeroBrane has an excellent Lua formatter built in that fires with: Cmd + I

Is there a way to trigger that to fire on save?

ryanpcmcquen
  • 6,285
  • 3
  • 24
  • 37

1 Answers1

3

Yes, you can create a plugin to do this using onEditorPreSave event or can make it an inline plugin by adding the following to the config file:

package {
  onEditorPreSave = function(self, editor)
    ide:GetMainFrame():ProcessEvent(wx.wxCommandEvent(
      wx.wxEVT_COMMAND_MENU_SELECTED, ID.REINDENT))
  end,
}

This will send a command to process reindentation event, which should have the desired effect.

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56