diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 2d5e109..ae125aa 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -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()