pechorin / any-jump.vim

Jump to any definition and references 👁 IDE madness without overhead 🚀
1.07k stars 40 forks source link

Dynamically extend the `grep`-bin scan paths? #112

Open goodboy opened 8 months ago

goodboy commented 8 months ago

It'd sure be handy to allow augmenting the rg/ag search paths for a given code base so as to be able to lookup defs for tokens not defined in the current repo / local directory tree.


As an example, say you are working on a project in an interpreted language like Python which enables dynamic lookup of all library paths with something like:

python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))"

Then you could combine it with rg like so:

rg -u 'open_nursery' @$(python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))")

And this would for example search all linked dependency libs token sets as well.


Afaict there's no global (let alone lang context specific) override variable for this?

it'd be handy to have some way to be able to conditionally augment the search domain. For example the ALE linter plugin offers overriding the exec and options when using ruff with something like

let g:ale_python_ruff_executable = 'ruff'
let g:ale_python_ruff_options = ''

Interested to see what others think (or if i somehow just missed this in the docs 😂 )

goodboy commented 8 months ago

ended up going with a slightly different approach in #113 by letting the user just define a rg -e <lang-patt> PATH generator cmd to be able to dynamically generate the paths to scan. Not sure if long run this is the best solution but it definitely is flexible enough to cover the simple case of having local code that provides a symbol def set, and we want to just sick the grep backend to those files..