TIL

I have auto-format on save enabled for some languages, for example go:

    vim.api.nvim_create_autocmd('BufWritePost', {
      group = 'Format',
      pattern = '*.go',
      callback = function()
        vim.lsp.buf.format()
      end
    })

For everything else, we can use the = nvim motion for indenting a file!

Sources: