Can anyone recommend a good formatter for yaml files?

As the title says, I’m looking for recommendations for a yaml formatter.
I’ve tried yamlfmt from PyPi but it seems to struggle with big files or lots of comments and sometimes just writes temporary files instead of overwriting the input file.

You could give yq a try:

There’s also the LSP route yaml-language-server which supports formatting. LSP Config entry

Thanks I am already using yaml-language-server for lsp but can’t get it to format.
All my other language servers will format with vim.lsp.buf.formatting but it doesn’t seem to work with yaml-language-server.
I see that in the settings yaml.format.enable is true by default but even explicitly setting that to true doesn’t seem to make a difference.