Change format_on_save to a whitelist instead of a blacklist
This commit is contained in:
@@ -686,14 +686,15 @@ require('lazy').setup({
|
|||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
-- You can specify filetypes to autoformat on save here:
|
||||||
-- have a well standardized coding style. You can add additional
|
local enabled_filetypes = {
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- lua = true,
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
-- python = true,
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
}
|
||||||
return nil
|
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
||||||
else
|
|
||||||
return { timeout_ms = 500 }
|
return { timeout_ms = 500 }
|
||||||
|
else
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
default_format_opts = {
|
default_format_opts = {
|
||||||
|
|||||||
Reference in New Issue
Block a user