mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-17 06:17:12 +09:00
Add latex support in comment plugin (#1725)
This commit is contained in:
@@ -24,6 +24,7 @@ ft["ruby"] = "# %s"
|
||||
ft["d"] = "// %s"
|
||||
ft["swift"] = "// %s"
|
||||
ft["elm"] = "-- %s"
|
||||
ft["tex"] = "% %s"
|
||||
|
||||
function onBufferOpen(buf)
|
||||
if buf.Settings["commenttype"] == nil then
|
||||
@@ -38,7 +39,7 @@ end
|
||||
function commentLine(bp, lineN)
|
||||
local line = bp.Buf:Line(lineN)
|
||||
local commentType = bp.Buf.Settings["commenttype"]
|
||||
local commentRegex = "^%s*" .. commentType:gsub("%*", "%*"):gsub("%-", "%-"):gsub("%.", "%."):gsub("%+", "%+"):gsub("%]", "%]"):gsub("%[", "%["):gsub("%%s", "(.*)")
|
||||
local commentRegex = "^%s*" .. commentType:gsub("%%","%%%%"):gsub("%$","%$"):gsub("%)","%)"):gsub("%(","%("):gsub("%?","%?"):gsub("%*", "%*"):gsub("%-", "%-"):gsub("%.", "%."):gsub("%+", "%+"):gsub("%]", "%]"):gsub("%[", "%["):gsub("%%%%s", "(.*)")
|
||||
local sel = -bp.Cursor.CurSelection
|
||||
local curpos = -bp.Cursor.Loc
|
||||
local index = string.find(commentType, "%%s") - 1
|
||||
@@ -98,7 +99,8 @@ function comment(bp, args)
|
||||
end
|
||||
|
||||
function trim(s)
|
||||
return (s:gsub("^%s*(.-)%s*$", "%1"))
|
||||
local trimmed = s:gsub("^%s*(.-)%s*$", "%1"):gsub("%%","%%%%")
|
||||
return trimmed
|
||||
end
|
||||
|
||||
function string.starts(String,Start)
|
||||
|
||||
Reference in New Issue
Block a user