Skip to content

Commit edfb294

Browse files
oriori1703PaulFinch
authored andcommitted
Change format_on_save to a whitelist instead of a blacklist
1 parent 7aacf4d commit edfb294

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

init.lua

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -701,14 +701,15 @@ require('lazy').setup({
701701
opts = {
702702
notify_on_error = false,
703703
format_on_save = function(bufnr)
704-
-- Disable "format_on_save lsp_fallback" for languages that don't
705-
-- have a well standardized coding style. You can add additional
706-
-- languages here or re-enable it for the disabled ones.
707-
local disable_filetypes = { c = true, cpp = true }
708-
if disable_filetypes[vim.bo[bufnr].filetype] then
709-
return nil
710-
else
704+
-- You can specify filetypes to autoformat on save here:
705+
local enabled_filetypes = {
706+
-- lua = true,
707+
-- python = true,
708+
}
709+
if enabled_filetypes[vim.bo[bufnr].filetype] then
711710
return { timeout_ms = 500 }
711+
else
712+
return nil
712713
end
713714
end,
714715
default_format_opts = {

0 commit comments

Comments
 (0)