Skip to content

Pluggable target selection engine #23

@ggandor

Description

@ggandor

Specifically thinking about Leap, besides Hop.

It would be win-win for everyone:

  • This plugin could focus on one thing - there would be no need to reinvent the wheel, i.e. hinting and the selection of targets, which is supposed to be more robust/flexible in Leap/Hop, since that is the very focus of the aforementioned plugins.
  • Both groups of users could be directed to this plugin, and there would be no need to develop/maintain e.g. leap-ast.nvim.

I'm a bit confused about the current state of things though: Treehopper depends on Hop for jumping, but why is Hop necessary for what is basically an api.nvim_win_set_cursor call? On the other hand, if Hop is a dependency, why not use Hop for hinting - why a redundant implementation for Visual mode?

Anyway, integrating with Leap would be super simple, you simply get the node positions (optionally sort them in a preferred order), and feed it to Leap that takes care of the rest. You can also give it a custom action callback, that can be a wrapper around the range selection functionality already implemented here for Visual/OP mode.

If we'd want to show the same label in multiple places (start & end of the node), that would require some tweaks in the Leap API, but obviously doable. Also, there is no need to respect the "global" defaults of Leap, the highlights (or anything else) can be customized for treehopping, via autocommands. (Check https://github.com/ggandor/leap.nvim#extending-leap.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions