Skip to content

Commit

Permalink
feat: add no_ignore option for fd
Browse files Browse the repository at this point in the history
  • Loading branch information
jamestrew committed Nov 5, 2023
1 parent 6e51d0c commit ea14b5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions lua/telescope/_extensions/file_browser/finders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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: )
Expand Down Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions lua/telescope/_extensions/file_browser/picker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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|)
Expand Down

0 comments on commit ea14b5b

Please sign in to comment.