diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index c3fe578..6357da0 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -16,15 +16,17 @@ return { opts = { notify_on_error = false, format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + -- Filetypes to apply formatting to on save. Remove from this list + -- to disable formatting on save for that filetype. + local filetypes = { + 'lua', + 'rust', + } local lsp_format_opt - if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' - else + if filetypes[vim.bo[bufnr].filetype] then lsp_format_opt = 'fallback' + else + lsp_format_opt = 'never' end return { timeout_ms = 500,