From aa9194f98d03a9cd412a3bbceec06f9659bce0ab Mon Sep 17 00:00:00 2001 From: bhagwan Date: Wed, 9 Feb 2022 22:52:52 -0800 Subject: [PATCH] more special character optimizations for fish, skim --- lua/fzf-lua/libuv.lua | 2 +- lua/fzf-lua/utils.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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)