Formatting the file on save


#1

I thought that’s the simplest thing to do. I have some Fortran source I want to format with a command-line tool fprettify.

Tried using save-autorun, but this unnecessarily creates a panel, which has to be closed manually.
Tried writing my own formatter plugin (sic!), with this as a starting point: https://github.com/keplersj/formatter-clang-format, but it’s impossible due to a closed unfixed bug: https://github.com/atom-community/formatter/issues/7

Is there any way I can format my code on save?


#2

The short answer is yes. The long answer starts with a question: do you mind if the solution formats all Fortran code, or do you want it to only target specific files or projects?


#3

I need to be able to disable this for specific projects. In particular, different projects may need different formatter configuration.