diff --git a/lua/fzf-lua/libuv.lua b/lua/fzf-lua/libuv.lua index 04c9a81..6ca4251 100644 --- a/lua/fzf-lua/libuv.lua +++ b/lua/fzf-lua/libuv.lua @@ -435,7 +435,7 @@ M.shellescape = function(s) else local ret = nil vim.o.shell = "sh" - if not s:match([["]]) then + if not s:match([["]]) and not s:match([[\]]) then -- if the original string does not contain double quotes -- replace surrounding single quote with double quotes -- temporarily replace all single quotes with double diff --git a/lua/fzf-lua/utils.lua b/lua/fzf-lua/utils.lua index 8081fd1..fe8039b 100644 --- a/lua/fzf-lua/utils.lua +++ b/lua/fzf-lua/utils.lua @@ -103,8 +103,8 @@ end function M.rg_escape(str) if not str then return str end -- [(~'"\/$?'`*&&||;[]<>)] - -- escape "\~$?*|[()" - return str:gsub('[\\~$?*|{\\[()-]', function(x) + -- escape "\~$?*|[()-^" + return str:gsub('[\\~$?*|{\\[()%-^]', function(x) return '\\' .. x end) end @@ -113,7 +113,7 @@ function M.sk_escape(str) if not str then return str end return str:gsub('["`]', function(x) return '\\' .. x - end) + end):gsub([[\\]], [[\\\\]]):gsub([[\%$]], [[\\\$]]) end function M.lua_escape(str)