Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs/fix: Telescope integration #149

Closed
wants to merge 3 commits into from

Conversation

rish987
Copy link

@rish987 rish987 commented May 8, 2023

Hi, thank you so much for the effort and careful design you have put into this plugin. I have made good use of the API that you have provided to integrate this plugin with nvim-telescope/telescope.nvim. This allows you to use Leap to select an entry (I mapped this to S) or both select and perform the default action on an entry (I mapped this to s):

asciicast

This required a small fix, as there were some calls to vim.api.nvim_buf_del_extmark, vim.api.nvim_buf/win_set_option that could trigger after the telescope window/buffer were deleted (and thus result in an error), so I protected these by checking vim.api.nvim_buf/win_is_valid before calling them.

I have added the config to the README, though I think it may be possible to turn this into its own telescope extension so you don't have to copy any code into your config (though it seems that those are generally use to define pickers rather than libraries of keymaps; I will look into it).

@IndianBoy42
Copy link
Contributor

are you aware of https://github.com/nvim-telescope/telescope-hop.nvim? it doesn't actually depend on hop.nvim. Is there any advantage to using leap.nvim as the target selection backend?

@ggandor
Copy link
Owner

ggandor commented May 13, 2023

Is there any advantage to using leap.nvim as the target selection backend?

not reinventing the wheel for every such plugin, easy to implement custom actions, consistent appearance & behavior (if one already uses Leap), etc.

@rish987
Copy link
Author

rish987 commented May 14, 2023

are you aware of https://github.com/nvim-telescope/telescope-hop.nvim?

Ah, in fact, I wasn't. I had tried searching for something like this but I suppose I didn't use the correct keywords. I've added a link to that plugin so it'll be easier to find for someone like me :P
It's probably best to direct people there for the time being, at least until we have completed #151 and if we're able to port most of the features in that plugin.

Is there any advantage to using leap.nvim as the target selection backend?

I agree with György's assessment, also using this plugin as a backend means a central place for configuration of label keys, appearance, etc. Another area where I could see this plugin really shine is in the selection between multiple autocomplete alternatives. If we were to try to go the telescope-hop.nvim route with that, we would have to re-implement the code for generating, displaying, and processing input for selecting between the labels. Integration with this plugin for autocomplete may be a bit more intricate however, so I think this is a good place to at least get started on #151.

@rish987
Copy link
Author

rish987 commented Jan 14, 2024

Hi! I think I'll close this for now. I'm planning to get back on track with my refactor initiative at #156 -- sorry, academic/life obligations became a bit overwhelming for me for some time, but now I should be able to find time for this again.

I'm thinking, once that refactor is done, we can perhaps have a separate plugin for integrations with other plugins (esp. those with custom UIs like neogit, Mason, nvim-tree, etc.), where we can put the code from this config and others, and the user can opt-in to various integrations. (Though, the effort to integrate with other plugins could be quite involved -- we got pretty lucky here with the fact that the Telescope API was already sufficient for our needs, but of course that won't be the case for every plugin, so it will probably be necessary to make a number of upstreams PRs to enable this integration.)

@rish987 rish987 closed this Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants