Skip to content

Commit ce353a9

Browse files
committed
Change format_on_save to a whitelist instead of a blacklist
1 parent 459b868 commit ce353a9

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
@@ -686,14 +686,15 @@ require('lazy').setup({
686686
opts = {
687687
notify_on_error = false,
688688
format_on_save = function(bufnr)
689-
-- Disable "format_on_save lsp_fallback" for languages that don't
690-
-- have a well standardized coding style. You can add additional
691-
-- languages here or re-enable it for the disabled ones.
692-
local disable_filetypes = { c = true, cpp = true }
693-
if disable_filetypes[vim.bo[bufnr].filetype] then
694-
return nil
695-
else
689+
-- You can specify filetypes to autoformat on save here:
690+
local enabled_filetypes = {
691+
-- lua = true,
692+
-- python = true,
693+
}
694+
if enabled_filetypes[vim.bo[bufnr].filetype] then
696695
return { timeout_ms = 500 }
696+
else
697+
return nil
697698
end
698699
end,
699700
default_format_opts = {

0 commit comments

Comments
 (0)