feat(plugins): add option to skip format-on-save for JavaScript buffers

This commit is contained in:
Prad Nukala committed 2026-07-13 15:07:21 -04:00
1 parent 6789eab509
commit 2311ab09c5
1 file changed
+11
+11
View File
@@ -91,4 +91,15 @@ return {
end,
})
end,
opts = function(_, opts)
-- Skip format-on-save for JavaScript buffers (.js/.mjs/.cjs); manual
-- :Format / <Leader>lf still works. Wraps the astrocommunity pack's
-- format_on_save so its autoformat toggle handling is preserved.
local pack_format_on_save = opts.format_on_save
opts.format_on_save = function(bufnr)
if vim.bo[bufnr].filetype == "javascript" then return end
if type(pack_format_on_save) == "function" then return pack_format_on_save(bufnr) end
return pack_format_on_save
end
end,
}