diff --git a/init.lua b/init.lua index 16d3c26..dffae4a 100644 --- a/init.lua +++ b/init.lua @@ -607,10 +607,16 @@ require('lazy').setup { 'stevearc/conform.nvim', opts = { notify_on_error = false, - format_on_save = { - timeout_ms = 500, - lsp_fallback = true, - }, + format_on_save = function(bufnr) + -- Enable format on save for specified filetypes + local enable_filetypes = { 'lua' } + if vim.tbl_contains(enable_filetypes, vim.bo[bufnr].filetype) then + return { + timeout_ms = 500, + lsp_fallback = true, + } + end + end, formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially