From 2311ab09c57489e1ef8220022ea85b66001683cf Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 13 Jul 2026 15:07:21 -0400 Subject: [PATCH] feat(plugins): add option to skip format-on-save for JavaScript buffers --- lua/plugins/conform.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 4142d7e..dd14af1 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -91,4 +91,15 @@ return { end, }) end, + opts = function(_, opts) + -- Skip format-on-save for JavaScript buffers (.js/.mjs/.cjs); manual + -- :Format / 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, }