live_grep escape hyphen, minor modification for 'sk'

main
bhagwan 3 years ago
parent 9785cafd9a
commit 0d24020629

@ -213,11 +213,14 @@ M.live_grep_native = function(opts)
opts.prompt, opts.prompt,
-- since we surrounded the skim placeholder with quotes
-- we need to escape them in the initial query
vim.fn.shellescape(query:gsub([["]], [[\"]])),
vim.fn.shellescape(query:gsub('["`]',
function(x)
return '\\' .. x
end)),
vim.fn.shellescape(
("(cd %s && %s)"):format(
vim.fn.shellescape(opts.cwd or '.'),
("sh -c %s"):format(vim.fn.shellescape(reload_command)))))
reload_command)))
else
opts.fzf_fn = {}
if opts.exec_empty_query or (opts.search and #opts.search > 0) then

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

Loading…
Cancel
Save