feat: add ^ and $ to characters handled by regex escape (#1007)

This commit is contained in:
Daniel Imfeld
2021-07-16 23:27:14 -10:00
committed by GitHub
parent 0708120a84
commit 3f17192322

View File

@@ -19,13 +19,14 @@ local filter = vim.tbl_filter
local files = {}
local escape_chars = function(string)
return string.gsub(string, "[%(|%)|\\|%[|%]|%-|%{%}|%?|%+|%*]", {
return string.gsub(string, "[%(|%)|\\|%[|%]|%-|%{%}|%?|%+|%*|%^|%$]", {
["\\"] = "\\\\", ["-"] = "\\-",
["("] = "\\(", [")"] = "\\)",
["["] = "\\[", ["]"] = "\\]",
["{"] = "\\{", ["}"] = "\\}",
["?"] = "\\?", ["+"] = "\\+",
["*"] = "\\*",
["*"] = "\\*", ["^"] = "\\^",
["$"] = "\\$",
})
end