diff --git a/lua/telescope/builtin/files.lua b/lua/telescope/builtin/files.lua index 1597bc9..7051305 100644 --- a/lua/telescope/builtin/files.lua +++ b/lua/telescope/builtin/files.lua @@ -57,6 +57,7 @@ end -- Support `find` and maybe let people do other stuff with it as well. files.find_files = function(opts) local find_command = opts.find_command + local hidden = opts.hidden local search_dirs = opts.search_dirs if search_dirs then @@ -68,6 +69,7 @@ files.find_files = function(opts) if not find_command then if 1 == vim.fn.executable("fd") then find_command = { 'fd', '--type', 'f' } + if hidden then table.insert(find_command, '--hidden') end if search_dirs then table.insert(find_command, '.') for _,v in pairs(search_dirs) do @@ -76,6 +78,7 @@ files.find_files = function(opts) end elseif 1 == vim.fn.executable("fdfind") then find_command = { 'fdfind', '--type', 'f' } + if hidden then table.insert(find_command, '--hidden') end if search_dirs then table.insert(find_command, '.') for _,v in pairs(search_dirs) do @@ -84,6 +87,7 @@ files.find_files = function(opts) end elseif 1 == vim.fn.executable("rg") then find_command = { 'rg', '--files' } + if hidden then table.insert(find_command, '--hidden') end if search_dirs then for _,v in pairs(search_dirs) do table.insert(find_command, v) @@ -91,6 +95,7 @@ files.find_files = function(opts) end elseif 1 == vim.fn.executable("find") then find_command = { 'find', '.', '-type', 'f' } + if not hidden then vim.tbl_extend("error", find_command, {'-not', '-path', '*/.*'}) end if search_dirs then table.remove(find_command, 2) for _,v in pairs(search_dirs) do