> If you want Black to format your Python files on save, write an autocommand. That's what they're there for. If you need help to do that, ask for it.
The real question would be:
Why does the 50 year old editor with supposedly a huge community and tons of editors not have support for a popular formatter for probably the most popular programming language on the planet, and instead everyone has to write their own (probably buggy) variation of that integration?
It does, you'd just have to install a python plugin that registers the autocommand-- or leave out the plugin and register the autocommand yourself. The (n)vim/emacs communities aren't fond of integrating the hot new thing for each language directly into the editor-- I think this is a lesson that comes from being 50 years old!
As for whether it would be buggy, I'd doubt it? Unless Black's principle of operation is different from most formatters, it should just write the formatted contents to the file, right? The autocommand you'd use would just run Black on your current file on each save. So where % is Vim's symbol for the name of the currently open file, :silent! suppresses stdout/stderr from the formatter, and :! runs a command:
autocmd BufWritePost *.py silent! !<format_cmd> %
(Don't quote me on that, but it should be essentially correct. I'm not at a computer right now.)
Actually, it looks like you can install an (n)vim plugin from the official Black repo here:
Anyway, I think it's actually a really cool effect of doing this that you realize a lot of the scaffolding underneath most editors _isn't_ that complicated! It's totally understandable :)
Because it's been here before the formatter and will be here after it. I don't think there is any support for any formatting tool, except the general act of formatting for every formatting tool. And if you find your config has multiple lines just to format languages you've touched, then it's time to build a plugin or search for one. And if you find it, and it's quite not like you want, extend it as most plugins are open source and free.
If the tool doesn't suit you, build your own or find another.
The real question would be:
Why does the 50 year old editor with supposedly a huge community and tons of editors not have support for a popular formatter for probably the most popular programming language on the planet, and instead everyone has to write their own (probably buggy) variation of that integration?