lukas-reineke / lsp-format.nvim

A wrapper around Neovims native LSP formatting.
559 stars 27 forks source link

Format on auto save #69

Open miladabc opened 1 year ago

miladabc commented 1 year ago

Thanks for your work on this plugin,
I was wondering if it is possible to format on auto save, I have this autocmd and your plugin does not format after this.

vim.api.nvim_create_autocmd("BufLeave", {
    group = vim.api.nvim_create_augroup("AutoSave", { clear = true }),
    callback = function(event)
        vim.api.nvim_command("update")
    end,
})
lukas-reineke commented 1 year ago

This is probably because autocommands are not nested by default. Take a look at :help autocmd-nested