diff options
| author | Jesse Leite <jesseleite@gmail.com> | 2021-03-31 03:47:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-31 09:47:21 +0200 |
| commit | 2c4efc2f8af0575526f7b5dcc35fba9e0f1cc944 (patch) | |
| tree | 7cbe0be55ccc13a49db719daa0157e04490b4739 /lua | |
| parent | aefc8317354426864a361d7b7d84848145d218c1 (diff) | |
fix: better relative path output in `live_grep` and `grep_string` (#683)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/builtin/files.lua | 32 |
1 files changed, 22 insertions, 10 deletions
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() |
