jalvesaq / zotcite

Neovim plugin for integration with Zotero
GNU General Public License v3.0
159 stars 13 forks source link

Ignore .bib file in Quarto Documents for Omnicomplete #47

Closed wklimowicz closed 2 years ago

wklimowicz commented 2 years ago

Hi,

Firstly just wanted to say a big thank you for this and especially for Nvim-R, I've used it basically every day for a few years.

I can't get the zotcite omnicomplete working properly in quarto documents, while also having the bib file in the same directory to generate the bibliography:

Case 1: Omnicomplete working but bibliography breaks

If I just make a qmd document without the settings in YAML, omnicomplete works fine:

---
title: Test
---
Omnicomlete from the Zotero database works here.

However to get the html output to display in quarto you need the extra snippet from the documentation:

Case 2: Bibliography working but Omnicomplete breaks

---
title: Test
bibliography: example_zotcite.bib
filters:
  - zotref.py
---
The YAML generates an `example_zotcite.bib` file in the same directory, 
and thereafter Omnicomplete only gets whatever is already in the `bib` file - 
you can't complete any extra references from Zotero.

I've either missed a setting in the documentation, or there needs to be a way for Zotcite to ignore the .bib file for completion in quarto documents.

I've tested this with a minimal .vimrc:

set nocompatible
filetype off 
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'jalvesaq/Nvim-R'
Plugin 'jalvesaq/zotcite'
call vundle#end() 
filetype plugin indent on 

Many thanks for all your work on these Plugins!

jalvesaq commented 2 years ago

I'm sorry, but I can't replicate the issue: even after the bib file is generated, the completion keeps getting items from Zotero. I tried with Neovim and vim-plug, and with Vim and your minimal vimrc (Vundle).

wklimowicz commented 2 years ago

So I've tried digging a bit more to identify the problem, since it always replicates for me.

image

By default my omnifunc is CompleteR, but if I manually run set omnifunc=zotcite#CompleteBib the quarto document works - (Zotero completion, bib file generation, etc), but code completion stops working. So the problem is the autocomplete from the bib file switches off the zotcite#CompleteBib element in CompleteR.

I can "fix" it by commenting out lines 187 - 200 in ftplugin/rmd_nvimr.vim in Nvim-R:

image

I'm not sure if that gives you any ideas on how to fix it permanently? I can obviously just keep this commented out, but I'm guessing other people might have the same. I'm running Fedora 36 and Neovim 0.8.

jalvesaq commented 2 years ago

I installed the python3-pybtex package, and now I can replicate the issue.

jalvesaq commented 2 years ago

Could you update Nvim-R and try again, please?

wklimowicz commented 2 years ago

It works now! Many thanks for the speedy fix, and all the work you do on these packages!