fix: better relative path output in live_grep and grep_string (#683)

This commit is contained in:
Jesse Leite
2021-03-31 03:47:21 -04:00
committed by GitHub
parent aefc831735
commit 2c4efc2f8a

View File

@@ -49,7 +49,15 @@ files.live_grep = function(opts)
prompt = escape_chars(prompt)
return flatten { vimgrep_arguments, prompt, opts.search_dirs or '.' }
local args = flatten { vimgrep_arguments, prompt }
if search_dirs then
table.insert(args, search_dirs)
elseif os_sep == '\\' then
table.insert(args, '.')
end
return args
end,
opts.entry_maker or make_entry.gen_from_vimgrep(opts),
opts.max_results,
@@ -82,17 +90,21 @@ files.grep_string = function(opts)
end
end
local args = flatten {
vimgrep_arguments,
word_match,
search,
}
if search_dirs then
table.insert(args, search_dirs)
elseif os_sep == '\\' then
table.insert(args, '.')
end
pickers.new(opts, {
prompt_title = 'Find Word',
finder = finders.new_oneshot_job(
flatten {
vimgrep_arguments,
word_match,
search,
search_dirs or "."
},
opts
),
finder = finders.new_oneshot_job(args, opts),
previewer = conf.grep_previewer(opts),
sorter = conf.generic_sorter(opts),
}):find()