dhruvmanila / browser-bookmarks.nvim

A Neovim plugin to open your browser bookmarks right from the editor!
MIT License
208 stars 14 forks source link

Raindrop.io Suggestions #34

Open CharlesARoy opened 1 year ago

CharlesARoy commented 1 year ago

Hi @dhruvmanila ,

Thanks for all your work in making the Raindrop bookmarks available, it works amazingly and I really appreciate it!

After using it for a bit, two ideas occurred to me that might make it even better.

  1. This might not be available via the Raindrop.io API, but it would be awesome if we could search for bookmarks using information beyond the title and URL. Above all, I'd be interested in searching among my tags. If it were possible to launch the Telescope fuzzy finder to search among Titles/URLs and/or tags, that would be even better.
  2. Loading all my bookmarks in a background process is super effective as long as I stay in the same instance of Neovim. I'm not sure how you load and store the bookmarks exactly, but it would be awesome if that loaded information was available to any instance of Neovim that is running. Is there a way to store the bookmarks in a local data structure that be loaded and updated by any instance of Neovim?

Edit: To help with 2, I did the logical thing and created an autocommand to start loading my bookmarks as soon as Nvim loads -- might be good to mention in the setup docs.

vim.api.nvim_create_autocmd({ "VimEnter" }, {
    callback = function()
        vim.cmd "lua require('telescope').extensions.bookmarks.bookmarks(opts)"
    end,
})
dhruvmanila commented 1 year ago

Thanks for all your work in making the Raindrop bookmarks available, it works amazingly and I really appreciate it!

Thanks a lot! Good to know you find this useful :)

For (1), we do support tags but currently it's only available for buku. I believe the API would already be sending this information so it should be trivial to add.

For (2), there are a few ideas but to give some context the bookmarks are stored in memory while the Neovim instance is running:

https://github.com/dhruvmanila/browser-bookmarks.nvim/blob/e643372d509d138d3244f917283b13f52a9cf5eb/lua/browser_bookmarks/browsers/raindrop.lua#L9-L11

  1. We could store it on disk and load it when invoked for the first time but then when do we refresh the cache or how to invalidate it? We could just start a background job on VimEnter.
  2. A new option to let user opt-in to start the background job on VimEnter. Maybe we could make it the default option and let user opt-out of it if they want to. This option can be provided in (1) as well.
CharlesARoy commented 1 year ago

That all sounds great to me!

  1. Personally, I only add like, 3-10 bookmarks per week, so my bookmarks don't change very much day to day. If they could be cached on disk that would be great. How/when to update them is definitely the most tricky part. Launching a background process to get the latest bookmarks on VimEnter sounds good. I don't know if there could be any issues if Vim is exited while the cache is being updated though.
  2. That sounds perfect.
thenbe commented 1 year ago

I created an fzf-raindrop picker that might be of interest. It only makes a single network request to the Raindrop API - to get a single CSV containing every item. This avoids any rate-limits. And by having local access to all the bookmarks, we can do some simple data massaging to enable searching through tags using the # character (eg. #mytag).

The picker does not "live" in neovim; personally I bind a global system keymap that launches a floating terminal window running the picker (as seen in the demo video).

dhruvmanila commented 1 year ago

Thanks for chiming in! I'll probably take a look at this sometime in this month.

CharlesARoy commented 1 year ago

Very cool @thenbe! Storing the bookmarks locally with the option to update them as needed is an excellent approach. The option to search through tags is also very useful. That said, using Telescope as my picker trumps everything else, at least for the time being.