From 7dd88c2f23a530425699cafa1cedd8e78c0937e3 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Wed, 15 Feb 2023 21:57:12 -0800 Subject: [PATCH] Don't auto-detect commenttype if last_ft is empty Also fixes commenttype for batch files. Fixes #2752 --- runtime/plugins/comment/comment.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/plugins/comment/comment.lua b/runtime/plugins/comment/comment.lua index 578f7422..213d2bff 100644 --- a/runtime/plugins/comment/comment.lua +++ b/runtime/plugins/comment/comment.lua @@ -7,7 +7,7 @@ local buffer = import("micro/buffer") local ft = {} ft["apacheconf"] = "# %s" -ft["bat"] = ":: %s" +ft["batch"] = ":: %s" ft["c"] = "// %s" ft["c++"] = "// %s" ft["cmake"] = "# %s" @@ -63,7 +63,7 @@ ft["zsh"] = "# %s" local last_ft function updateCommentType(buf) - if buf.Settings["commenttype"] == nil or last_ft ~= buf.Settings["filetype"] then + if buf.Settings["commenttype"] == nil or (last_ft ~= buf.Settings["filetype"] and last_ft ~= nil) then if ft[buf.Settings["filetype"]] ~= nil then buf.Settings["commenttype"] = ft[buf.Settings["filetype"]] else