quarto-dev / quarto-nvim

Quarto mode for Neovim
Other
356 stars 13 forks source link

Hover and Go-To for citekeys #150

Open lasse16 opened 2 weeks ago

lasse16 commented 2 weeks ago

Hi, I know these are more likely lsp-features, but I looked around and did not find a good solution.

The features I want are all related to cite keys, like @Yu2013.

On Hover I would like to see the bibtex entry in a pop-up, or only its abstract. I am not sure about which I prefer.

On Go-To-Definition, open the entry in the bibtex file.

If possible, gf on a citekey could open the associated pdf in an external problem. I personally have a file = path/ field in each of my bibtex entries.

Is there a good way to accomplish this with Quarto or the common lsps ?

I had a look around and found a way to accomplish it with importing the bibtex file into a https://github.com/papis/papis library and using https://github.com/jghauser/papis.nvim with its at-cursor functions.

Does anybody know of a better way?

There is a quarto lsp, which AFAIK is WIP. Marksman-Lsp does not support this. Citekey completion is already done with a nvim-cmp source.

lasse16 commented 2 weeks ago

Just to be clear, I consider Papis as only a workaround and would really like to find a better solution that only relies on a bibtex file.

jmbuhr commented 2 weeks ago

I love the idea, because what I currently do is also a workaround. Since I get completions for bib entries via https://github.com/jmbuhr/cmp-pandoc-references I sometimes find myself just going into insert mode and deleting the last character to see the full title as a hover. Image

Maybe this is a good opportunity to combine two of my plugins, https://github.com/jmbuhr/cmp-pandoc-references and https://github.com/jmbuhr/telescope-zotero.nvim, where the latter already has the complete zotero database, including path's, into one plugin that functions as a language server (like https://github.com/jmbuhr/otter.nvim does it)

lasse16 commented 2 weeks ago

So, we have a similar setup 😄 I am also using your nvim-cmp source.

I am using the https://github.com/nvim-telescope/telescope-bibtex.nvim as a telescope finder though.

I am keen on using my bibtex file as a single source of truth, and since it does allow any other fields. So, in the last to days I switched away from Papis.

It required an SQLite database and copied all bibtex entries into separate yaml files, which then became the source of truth.

Now, I am using the simplest solution and just have python scripts mapped to keys that regex parse my .bib file for the entry or the file field.

Thats also probably my last update for a while. I've got a thesis to finish 😄

jmbuhr commented 2 weeks ago

I just remembered, that I already accepted a PR for the zotero integration that added pdf opening! https://github.com/jmbuhr/telescope-zotero.nvim/pull/13 Might be handy for you as well.

Now I'll also finish my thesis ;)