Open dbarnett opened 9 years ago
Our hacky solution when this came up (for imports+formatting in java) was to define a little one-off formatter with its own formatter name that delegated and called formatter A then formatter B.
As noted in #178, you can't just invoke :AutoFormatBuffer
twice and its docs don't explicitly explain it'll replace any previous autoformatting each time you invoke it.
I think my hacky solution is a bit easier than what you describe, since I only needed to add a function to do the delegation, instead of a whole formatter.
Yes, that's probably close to what I would've done as a one-off workaround. For our purposes on the java thing, we were solving a common issue and couldn't plop arbitrary autocmds into everyone's vimrc.
For some types of files you might want to run more than one formatter, for instance sort C++ includes (which clang-format doesn't handle) and then format with clang-format. Could codefmt support configuring a list of formatters instead of a single formatter? E.g.