From 0a734ae49d166a56e4f02295ee97508180160491 Mon Sep 17 00:00:00 2001 From: TimUntersberger <32014449+TimUntersberger@users.noreply.github.com> Date: Mon, 14 Sep 2020 00:13:46 +0200 Subject: [PATCH] feat: add find_command option for find_files (#73) --- lua/telescope/builtin.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lua/telescope/builtin.lua b/lua/telescope/builtin.lua index db29316..36a585c 100644 --- a/lua/telescope/builtin.lua +++ b/lua/telescope/builtin.lua @@ -366,13 +366,16 @@ end builtin.find_files = function(opts) opts = opts or {} - local find_command = nil - if 1 == vim.fn.executable("fd") then - find_command = { 'fd', '--type', 'f' } - elseif 1 == vim.fn.executable("fdfind") then - find_command = { 'fdfind', '--type', 'f' } - elseif 1 == vim.fn.executable("rg") then - find_command = { 'rg', '--files' } + local find_command = opts.find_command + + if not find_command then + if 1 == vim.fn.executable("fd") then + find_command = { 'fd', '--type', 'f' } + elseif 1 == vim.fn.executable("fdfind") then + find_command = { 'fdfind', '--type', 'f' } + elseif 1 == vim.fn.executable("rg") then + find_command = { 'rg', '--files' } + end end if not find_command then