Closed avegancafe closed 4 months ago
Thanks for the suggestion!
Indeed, customizing built-in picker with CLI arguments is not supported. This is mostly to avoid extra documentation for which arguments area used by default plus the way to override them. The main CLI tool used in 'mini.pick' is rg
which does have the global way to configure how it does the search.
Currently suggested approach is to indeed either configure tool globally or use builtin.cli()
directly with any set of arguments which will not conflict with the ones used by default.
Closing as not planned.
@echasnovski would you by any chance be able to scan over that commit I just pushed? I totally understand if not, especially 'cause it's in a LISP. But this seems like quite a lot of code needed to get the same behavior as the built in files
picker, when I basically just wanted to add --hidden
as an argument to the fd
tool
EDIT:
To clarify, a lot of the pain in this is that a lot of those functions called in the builtin files picker are not public, like that H.cli_postprocess
or H.show_with_icon
and such
@echasnovski would you by any chance be able to scan over that commit I just pushed? I totally understand if not, especially 'cause it's in a LISP. But this seems like quite a lot of code needed to get the same behavior as the built in
files
picker, when I basically just wanted to add--hidden
as an argument to thefd
toolEDIT: To clarify, a lot of the pain in this is that a lot of those functions called in the builtin files picker are not public, like that
H.cli_postprocess
orH.show_with_icon
and such
There is no need in cli_postprocess
. Here is the suggested approach with showing icons:
require('mini.pick').setup()
MiniPick.registry.files_fd = function()
local command = { 'fd', '--type=f', '--no-follow', '--color=never', '--hidden' }
local show_with_icons = function(buf_id, items, query)
return MiniPick.default_show(buf_id, items, query, { show_icons = true })
end
local source = { name = 'Files fd', show = show_with_icons }
return MiniPick.builtin.cli({ command = command }, { source = source })
end
Here is the approach without icons:
MiniPick.registry.files_fd = function()
local command = { 'fd', '--type=f', '--no-follow', '--color=never', '--hidden' }
return MiniPick.builtin.cli({ command = command })
end
Now using :Pick files_fd
should use fd
and show hidden files.
Ooh nice! I'll do that instead, thank you so much for checking it out
Contributing guidelines
Module(s)
mini.pick
Description
I'm not sure if this is a bug or a feature request, but the "official" docs here say to follow the configuration patterns for the individual tool in order to be able to configure pickers, but
fd
doesn't provide a global way to always display hidden files, and mini.pick from what I can tell has no way to set arguments that need to be forwarded to the command run powering the builtinfiles
picker. This seems like both a small feature and one I'm surprised doesn't exist, given how ubiquitous it is in all of the other pickers I've tried. Is this possible in mini.pick? I am willing to add clarifying documentation if it is.Neovim version
v0.10.0-dev-2104+gfd2ed024c-Homebrew
Steps to reproduce
Any mini.pick configuration using
fd
Expected behavior
I am able to pass the
--hidden
argument tofd
when usingmini.pick.builtin.files
pickerActual behavior
I am not able to pass any CLI arguments