pechorin / any-jump.vim

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

Add init support for a user defined PATH/glob cmd #113

Open goodboy opened 8 months ago

goodboy commented 8 months ago

An attempt to resolve #112.

I'm not sure if this kinda thing will make all that much sense for AOT compiled langs (since often getting lib symbols isn't so straight forward as running some command to produce source-code-file-containing directories) but, it definitely is a thing in a language like python which users often dev / deploy in "isolated" runtime environments ("virtual envs"). In this case I have defined my custom glob scanner as:

let g:any_jump_glob_scanner = join([
    \'python',
    \'-c',
    \'"import os, site;',
    \"print(' '.join('{}'.format(d)",
    \'for d in site.getsitepackages()))',
    \'"',
    \])

which allows searching symbol defs in the user's locally activated python runtime env and thus the env specific ../site-packages/*.


Also included are some slight formatting tweaks in a couple of spots that seemed to have extra whitespace and a couple tweaks to the rg -g '!<globpatt>' quoting to work better when echoing the full cmd from vim for manuall copy/pasta debugging.


Still TODO

goodboy commented 8 months ago

Huh interestingly I seem to be getting some weird relative path thing when trying to "preview" the context of a given match?

screenshot-2023-11-25_17-25-37

it seems to be slapping the home-dir path in twice?