more special character optimizations for fish, skim

main
bhagwan 2 years ago
parent fdd3874367
commit aa9194f98d

@ -435,7 +435,7 @@ M.shellescape = function(s)
else else
local ret = nil local ret = nil
vim.o.shell = "sh" 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 -- if the original string does not contain double quotes
-- replace surrounding single quote with double quotes -- replace surrounding single quote with double quotes
-- temporarily replace all single quotes with double -- temporarily replace all single quotes with double

@ -103,8 +103,8 @@ end
function M.rg_escape(str) function M.rg_escape(str)
if not str then return str end if not str then return str end
-- [(~'"\/$?'`*&&||;[]<>)] -- [(~'"\/$?'`*&&||;[]<>)]
-- escape "\~$?*|[()" -- escape "\~$?*|[()-^"
return str:gsub('[\\~$?*|{\\[()-]', function(x) return str:gsub('[\\~$?*|{\\[()%-^]', function(x)
return '\\' .. x return '\\' .. x
end) end)
end end
@ -113,7 +113,7 @@ function M.sk_escape(str)
if not str then return str end if not str then return str end
return str:gsub('["`]', function(x) return str:gsub('["`]', function(x)
return '\\' .. x return '\\' .. x
end) end):gsub([[\\]], [[\\\\]]):gsub([[\%$]], [[\\\$]])
end end
function M.lua_escape(str) function M.lua_escape(str)

Loading…
Cancel
Save