diff --git a/README.md b/README.md index 9b572c4f..7b50ba54 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ require("telescope").setup { select_buffer = false, hidden = { file_browser = false, folder_browser = false }, respect_gitignore = vim.fn.executable "fd" == 1 + no_ignore = false, follow_symlinks = false, browse_files = require("telescope._extensions.file_browser.finders").browse_files, browse_folders = require("telescope._extensions.file_browser.finders").browse_folders, diff --git a/lua/telescope/_extensions/file_browser/finders.lua b/lua/telescope/_extensions/file_browser/finders.lua index a0bed5e2..e9bcf0e5 100644 --- a/lua/telescope/_extensions/file_browser/finders.lua +++ b/lua/telescope/_extensions/file_browser/finders.lua @@ -62,9 +62,13 @@ local function fd_file_args(opts) if not opts.respect_gitignore then table.insert(args, "--no-ignore-vcs") end + if opts.no_ignore then + table.insert(args, "--no-ignore") + end if opts.follow_symlinks then table.insert(args, "--follow") end + vim.print(args) return args end @@ -170,6 +174,7 @@ end ---@field depth number: file tree depth to display (default: 1) ---@field hidden table|boolean: determines whether to show hidden files or not (default: `{ file_browser = false, folder_browser = false }`) ---@field respect_gitignore boolean: induces slow-down w/ plenary finder (default: false, true if `fd` available) +---@field no_ignore boolean: disable use of ignore files like .gitignore/.ignore/.fdignore (default: false, requires `fd`) ---@field follow_symlinks boolean: traverse symbolic links, i.e. files and folders (default: false, only works with `fd`) ---@field hide_parent_dir boolean: hide `../` in the file browser (default: false) ---@field dir_icon string: change the icon for a directory (default: ) @@ -199,6 +204,7 @@ fb_finders.finder = function(opts) depth = vim.F.if_nil(opts.depth, 1), -- depth for file browser auto_depth = vim.F.if_nil(opts.auto_depth, false), -- depth for file browser respect_gitignore = vim.F.if_nil(opts.respect_gitignore, has_fd), + no_ignore = vim.F.if_nil(opts.no_ignore, false), follow_symlinks = vim.F.if_nil(opts.follow_symlinks, false), files = vim.F.if_nil(opts.files, true), -- file or folders mode grouped = vim.F.if_nil(opts.grouped, false), diff --git a/lua/telescope/_extensions/file_browser/picker.lua b/lua/telescope/_extensions/file_browser/picker.lua index 48d8a326..99f076b1 100644 --- a/lua/telescope/_extensions/file_browser/picker.lua +++ b/lua/telescope/_extensions/file_browser/picker.lua @@ -66,6 +66,7 @@ local fb_picker = {} ---@field select_buffer boolean: select current buffer if possible; may imply `hidden=true` (default: false) ---@field hidden table|boolean: determines whether to show hidden files or not (default: `{ file_browser = false, folder_browser = false }`) ---@field respect_gitignore boolean: induces slow-down w/ plenary finder (default: false, true if `fd` available) +---@field no_ignore boolean: disable use of ignore files like .gitignore/.ignore/.fdignore (default: false, requires `fd`) ---@field follow_symlinks boolean: traverse symbolic links, i.e. files and folders (default: false, only works with `fd`) ---@field browse_files function: custom override for the file browser (default: |fb_finders.browse_files|) ---@field browse_folders function: custom override for the folder browser (default: |fb_finders.browse_folders|)