ivy.nvim icon indicating copy to clipboard operation
ivy.nvim copied to clipboard

Allow the end user to use internal utils and libivy.

Open arnevm123 opened this issue 8 months ago • 3 comments

Problem to solve

I was playing around with the plugin and tried to make a recent files backend. Some issues that I found while doing this were that I had to reimplement some basic functionality form the utils (file_action for this one). I also did not have the ability to search, it would be handy to have access to the libivy API (eg. ivy_match).

Proposal

Exposing (part of) the utils and libivy API to the user. I understand that this would mean that these need to be documented, so I see why this would be something to do with caution.

Further details

I played around with it locally, and I just exposed utils and libivy (same as run and register backend) then I could just create a backend file in my local config and require this file. Then I can copy paste a backend from the source code to my local nvim config.

Then I can call ivy.register_backend(require("local.backends.ag")) after calling the setup function, and it works just like the internal backends.

I think exposing these API's will make it really easy for users to implement personal commands. Eg. recent files is just 90% copy pasting of buffers and then just changing getting buffers to getting recent files.

A lot of functionality can easily be ported over from looking at Telescope (that's how I found the oldfiles)).

And then these user made commands can be kept in the wiki section.

Not sure what your thoughts on this would be. If anything is not clear, feel free to ask :smile:

arnevm123 avatar Jun 29 '24 06:06 arnevm123