summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsbjørn Håland <asbjornhaland@users.noreply.github.com>2021-02-12 22:31:27 +0100
committerGitHub <noreply@github.com>2021-02-12 22:31:27 +0100
commit1c5e42a6a5a6d29be8fbf8dcefb0d8da535eac9a (patch)
tree6b20d85c1fa72555623b587104718f37bc6c31ae
parent09d1e3a6078ca8ae71724bd38cad6c379e8b3525 (diff)
feat: add 'follow' opt to find_files (#530)
This will add possibility to follow symlinks
-rw-r--r--lua/telescope/builtin/files.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua
index b450eab..03828e6 100644
--- a/lua/telescope/builtin/files.lua
+++ b/lua/telescope/builtin/files.lua
@@ -97,6 +97,7 @@ end
files.find_files = function(opts)
local find_command = opts.find_command
local hidden = opts.hidden
+ local follow = opts.follow
local search_dirs = opts.search_dirs
if search_dirs then
@@ -109,6 +110,7 @@ files.find_files = function(opts)
if 1 == vim.fn.executable("fd") then
find_command = { 'fd', '--type', 'f' }
if hidden then table.insert(find_command, '--hidden') end
+ if follow then table.insert(find_command, '-L') end
if search_dirs then
table.insert(find_command, '.')
for _,v in pairs(search_dirs) do
@@ -118,6 +120,7 @@ files.find_files = function(opts)
elseif 1 == vim.fn.executable("fdfind") then
find_command = { 'fdfind', '--type', 'f' }
if hidden then table.insert(find_command, '--hidden') end
+ if follow then table.insert(find_command, '-L') end
if search_dirs then
table.insert(find_command, '.')
for _,v in pairs(search_dirs) do
@@ -127,6 +130,7 @@ files.find_files = function(opts)
elseif 1 == vim.fn.executable("rg") then
find_command = { 'rg', '--files' }
if hidden then table.insert(find_command, '--hidden') end
+ if follow then table.insert(find_command, '-L') end
if search_dirs then
for _,v in pairs(search_dirs) do
table.insert(find_command, v)
@@ -138,6 +142,7 @@ files.find_files = function(opts)
table.insert(find_command, { '-not', '-path', "*/.*" })
find_command = flatten(find_command)
end
+ if follow then table.insert(find_command, '-L') end
if search_dirs then
table.remove(find_command, 2)
for _,v in pairs(search_dirs) do