summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorCorentin Brunel <cocodu13820@hotmail.fr>2020-09-12 23:52:24 -0400
committerGitHub <noreply@github.com>2020-09-12 23:52:24 -0400
commit3d423a3b592ab49cbe89a4bf88d2cab6bd663509 (patch)
treee01a9062c13b0a2349e73183e3a1699d3b759e1e /lua
parentebd090c0fe8a3f5acff0897d8724ac0f281db9d2 (diff)
feat: Add support for ripgrep in "find_files" builtin (#70)
* feat: Add support for ripgrep in "find_files" builtin * docs: Add mention about "ripgrep" for find_files builtin
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/builtin.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua
index a14c08a..db29316 100644
--- a/lua/telescope/builtin.lua
+++ b/lua/telescope/builtin.lua
@@ -366,15 +366,17 @@ end
builtin.find_files = function(opts)
opts = opts or {}
- local fd_string = nil
+ local find_command = nil
if 1 == vim.fn.executable("fd") then
- fd_string = "fd"
+ find_command = { 'fd', '--type', 'f' }
elseif 1 == vim.fn.executable("fdfind") then
- fd_string = "fdfind"
+ find_command = { 'fdfind', '--type', 'f' }
+ elseif 1 == vim.fn.executable("rg") then
+ find_command = { 'rg', '--files' }
end
- if not fd_string then
- print("You need to install fd or submit PR for different default file finder :)")
+ if not find_command then
+ print("You need to install either fd or rg. You can also submit a PR to add support for another file finder :)")
return
end
@@ -387,7 +389,7 @@ builtin.find_files = function(opts)
pickers.new(opts, {
prompt = 'Find Files',
finder = finders.new_oneshot_job(
- {fd_string, '--type', 'f'},
+ find_command,
opts
),
previewer = previewers.cat.new(opts),