echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
5.42k stars 191 forks source link

Support union of spotters in 'mini.jump2d' #365

Closed fgombault closed 1 year ago

fgombault commented 1 year ago

Contributing guidelines

Module(s)

mini.jump2d

Description

mini.jump2d can be setup() with a custom spotter function, that's awesome.

AFAIK due to the limitations of lua pattern matching, the default spotter function in jump2d.lua has to compose a merge of unique jump targets from half a dozen simple regexes.

The feature request is that the H module of jump2d.lua also be exported, so that users can also take advantage of it and use the merge_unique() helper function to implement their custom spotter function.

Or, alternatively → if the "spotter" option handling can be enhanced to accept an array of lua patterns, this could also meet 90% of custom spotter use cases (possibly being more user-friendly as well).

echasnovski commented 1 year ago

Thanks for the suggestion! This is a really interesting one.

I think the best approach to solve this pain point is to allow several patterns in gen_pattern_spotter(). It should result into union of all spots.

I'll think about it.

echasnovski commented 1 year ago

I've just pushed an update of 'mini.jump2d' which contains gen_union_spotter(). I think this is a better and more versatile approach to the problem of combining results of several spotters. Here is its documentation with usage examples.