apply formatting on save to all files

This commit is contained in:
Erica Marigold 2024-03-05 12:26:29 +05:30
parent 7f5fbbf08b
commit 987eabdb07
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -69,19 +69,19 @@ return {
temp_dir = nil,
update_in_insert = false,
-- formatting on save
--on_attach = function(client, bufnr)
-- if client.supports_method("textDocument/formatting") then
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
-- vim.api.nvim_create_autocmd("BufWritePre", {
-- group = augroup,
-- buffer = bufnr,
-- callback = function()
-- vim.lsp.buf.format({ bufnr = bufnr })
-- end,
-- })
-- end
--end,
} -- end of setup
on_attach = function(client, bufnr)
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format { bufnr = bufnr }
end,
})
end
end,
}
end,
},