Replies: 1 comment
-
@kristijanhusak, @lyz-code, I created a couple of PRs, which realize my idea. Have a look at #731 in nvim-orgmode and #15 and #16 in Telescope-orgmode. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently working on a feature for Telescope-orgmode to create links with telescope support. The current link-inserting feature is quite basic and not very convenient, if you have a lot of org-files.
While playing around with the code, I quickly realized, that this is not as easy as I thought with the current API of nvim-orgmode. I would either have to implement a lot of link semantics within Telescope-orgmode or some changes to nvim-orgmode would be needed.
After dabbeling a little bit more through the code, I came to the conclusion, that there are basically two potions:
Option 1: Extend API with
OrgApi.insert_link
Just extending the API would be the simplest solution, although it would involve some smaller refactorings.
Most of the code in
OrgMappings:insert_link
should be reusable, so it could either went into the newOrgApi.insert_link
or into an internal utility function. It takes a target and does everything else what is currently done inOrgMapping:insert_link
to create and insert the actual link string (including prompting for a description).The
OrgMappings:insert_link
function now only prompts the user to insert a link and calls the Api-Function to keep the existing feature.Then I can implement an insert_link function in Telescope-orgmode (which uses a lot of existing code of the feature to search for headlines), let the user choose the target via Telescope picker and call
OrgApi.insert_link
from there.Option 2: Provide hooks to connect callbacks for searching
This would be more effort and clearly needs some back and forth to get a stabelized API. But it would allow to inject Telescope magic at several points in nvim-orgmode, where some searching is needed, without maintaining the code in the main plugin.
@kristijanhusak and @lyz-code, what are your opinions on these ideas?
I would properly firstly implement Option 1, look how it plays out and make PRs to nvim-orgmode and telescope-orgmode.
Beta Was this translation helpful? Give feedback.
All reactions