Make the commenttype option useful (#2735)

This commit is contained in:
Rein F 2023-02-06 03:30:12 +01:00 committed by GitHub
parent b0cd92b70f
commit eb6daab169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,11 +60,17 @@ ft["zig"] = "// %s"
ft["zscript"] = "// %s"
ft["zsh"] = "# %s"
local last_ft
function updateCommentType(buf)
if ft[buf.Settings["filetype"]] ~= nil and ft[buf.Settings["filetype"]] ~= nil then
buf.Settings["commenttype"] = ft[buf.Settings["filetype"]]
elseif buf.Settings["commenttype"] == nil then
buf.Settings["commenttype"] = "# %s"
if buf.Settings["commenttype"] == nil or last_ft ~= buf.Settings["filetype"] then
if ft[buf.Settings["filetype"]] ~= nil then
buf.Settings["commenttype"] = ft[buf.Settings["filetype"]]
else
buf.Settings["commenttype"] = "# %s"
end
last_ft = buf.Settings["filetype"]
end
end