Skip to content

Commit a4f0735

Browse files
committed
changed Conform's format_on_save lambda so that buffers that match disable_filetypes return nil. This allows you to enable a formatter for langages in the disable_filetypes table to have a formatter that can be run manually with Leader-f but doesnt enable format_on_save for them
1 parent 34e7d29 commit a4f0735

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

init.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -744,16 +744,14 @@ require('lazy').setup({
744744
-- have a well standardized coding style. You can add additional
745745
-- languages here or re-enable it for the disabled ones.
746746
local disable_filetypes = { c = true, cpp = true }
747-
local lsp_format_opt
748747
if disable_filetypes[vim.bo[bufnr].filetype] then
749-
lsp_format_opt = 'never'
748+
return nil
750749
else
751-
lsp_format_opt = 'fallback'
750+
return {
751+
timeout_ms = 500,
752+
lsp_format = 'fallback',
753+
}
752754
end
753-
return {
754-
timeout_ms = 500,
755-
lsp_format = lsp_format_opt,
756-
}
757755
end,
758756
formatters_by_ft = {
759757
lua = { 'stylua' },

0 commit comments

Comments
 (0)