Skip to content

Commit af8d81c

Browse files
oriori1703dribic
authored andcommitted
Change format_on_save to a whitelist instead of a blacklist
Signed-off-by: Dejan Ribič <[email protected]>
1 parent 1aac1d3 commit af8d81c

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
@@ -696,14 +696,15 @@ require('lazy').setup({
696696
opts = {
697697
notify_on_error = false,
698698
format_on_save = function(bufnr)
699-
-- Disable "format_on_save lsp_fallback" for languages that don't
700-
-- have a well standardized coding style. You can add additional
701-
-- languages here or re-enable it for the disabled ones.
702-
local disable_filetypes = { c = true, cpp = true }
703-
if disable_filetypes[vim.bo[bufnr].filetype] then
704-
return nil
705-
else
699+
-- You can specify filetypes to autoformat on save here:
700+
local enabled_filetypes = {
701+
-- lua = true,
702+
-- python = true,
703+
}
704+
if enabled_filetypes[vim.bo[bufnr].filetype] then
706705
return { timeout_ms = 500 }
706+
else
707+
return nil
707708
end
708709
end,
709710
default_format_opts = {

0 commit comments

Comments
 (0)