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