summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Imfeld <daniel@imfeld.dev>2021-07-16 23:27:14 -1000
committerGitHub <noreply@github.com>2021-07-17 16:27:14 +0700
commit3f17192322a32da1bd445cd7153f00960480cb28 (patch)
tree50dbef7686283f85f35853dcacad8142d92a0897
parent0708120a84e62d374a97ddbcf9219988fce50895 (diff)
feat: add ^ and $ to characters handled by regex escape (#1007)
-rw-r--r--lua/telescope/builtin/files.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua
index d13b81a..2156223 100644
--- a/lua/telescope/builtin/files.lua
+++ b/lua/telescope/builtin/files.lua
@@ -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