From 7c4c61acb97303e264176a2bf98a6cc12597ad53 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Tue, 18 Jan 2022 12:39:07 -0800 Subject: [PATCH] properly escape lua special chars in 'path.relative' (closes #315) --- lua/fzf-lua/path.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/fzf-lua/path.lua b/lua/fzf-lua/path.lua index e513ee8..2e7a84b 100644 --- a/lua/fzf-lua/path.lua +++ b/lua/fzf-lua/path.lua @@ -47,7 +47,9 @@ function M.extension(path) end function M.to_matching_str(path) - return path:gsub('(%-)', '(%%-)'):gsub('(%.)', '(%%.)'):gsub('(%_)', '(%%_)') + -- return path:gsub('(%-)', '(%%-)'):gsub('(%.)', '(%%.)'):gsub('(%_)', '(%%_)') + -- above is missing other lua special chars like '+' etc (#315) + return utils.lua_regex_escape(path) end function M.join(paths)