Search code examples
sublimetextauto-indentautoformatting

SublimeText: autoindent on save?


I'm wondering if there is any way to autoformat code in ST3 for a specified event (here on save). For instance, I would like Sublime to format my code each time I save my code (and for any languages).

Is there a plugin for that? Or can I create a shortcut in config to trigger this process?

I'll appreciate your help :)


Solution

  • Thank your for your help jsnprtr but I found another solution. Unfortunately, with ST3, I was unable to run save command in a macro. I tried to design a tiny plugin but I didn't succeed.

    I found this plugin which allows to run multiple commands on a custom shortcut: https://github.com/jisaacks/ChainOfCommand

    With it, I am now able to format my code on save: I just run indent and save commands :)

    If some guys have other tricks to improve autoformatting when writing code with ST, I'll appreciate their contribution ;)