linrongbin16 / fzfx.nvim

A Neovim fuzzy finder that updates on every keystroke.
https://linrongbin16.github.io/fzfx.nvim/
MIT License
122 stars 5 forks source link

[Feature] Configuring of a cwd context for various pickers #558

Closed asmodeus812 closed 7 months ago

asmodeus812 commented 7 months ago

There are some pickers, which are not directly related to running a command, like buffers, oldfiles, lsp diagnostics etc, that might still benefit from filtering on a cwd context configuration. For example when listing buffers, to list only those for a specific working directory, similarly for lsp diagnostics (global ones) one would often like to show the ones only for the current workspace/cwd (usually required if we have a single lsp instance attached to several work spaces) I am sure there a lot of other pickers where this might make sense too, these are the ones off the top of my head.

linrongbin16 commented 7 months ago

There are some pickers, which are not directly related to running a command, like buffers, oldfiles, lsp diagnostics etc, that might still benefit from filtering on a cwd context configuration. For example when listing buffers, to list only those for a specific working directory, similarly for lsp diagnostics (global ones) one would often like to show the ones only for the current workspace/cwd (usually required if we have a single lsp instance attached to several work spaces) I am sure there a lot of other pickers where this might make sense too, these are the ones off the top of my head.

Hi, it's a fare requirement, I will do it after #556, #557 get merged.


The cwd is current working directory? You can directly get it with vim.fn.getcwd() in a picker (or provider in this plugin).

Since providers are just lua functions, that will be invoked during every command running.

asmodeus812 commented 7 months ago

Hi, yes indeed the current working directory, i was considering more along the lines of being able to pass the cwd as an argument to a picker, as of now i don't know if fzfx is able to accept opts on the fly. Something like FzfxFiles cwd="....", or the equivalent through the lua api.

linrongbin16 commented 7 months ago

Hi, yes indeed the current working directory, i was considering more along the lines of being able to pass the cwd as an argument to a picker, as of now i don't know if fzfx is able to accept opts on the fly. Something like FzfxFiles cwd="....", or the equivalent through the lua api.

the architecture should support such case, but create new provider will require a lot of engineering effort actually.

you can take a look into each file in the fzfx.cfg module, they contains the high level implementations of a fzfx command.