1

I've noticed that (coc-)vimtex gives suggestions about bib(la)tex keys and allows too searching in the entries of the literature.

Now this search works sometimes for me, sometimes not (see the gif). Does someone have an idea what might be causing this? (I already explicitly set let g:vimtex_complete_bib_simple=0)

Gif: As you can see e.g. abc works, but efg doesn't

Regarding my setup: I've installed vimtex along with coc-vimtex and am using neovim.

I have to admit that :checkhealth shows that - WARNING: Compiler callbacks will not work! for vimtex and suggests installing neovim-remote for backward sync, but I don't think that this is the problem as it is working already sometimes.

1 Answer 1

3

The problem here is that you are mixing two types of completion "backends": The built-in omni completion and the automatic completion by coc.nvim.

VimTeX provides an omni-complete function which is connected to the standard CTRL-X CTRL-O key combo. When you write \cite{efg then type CTRL-X CTRL-O, then the completion works "as expected", because the completion is now fully handled by the omni completion.

However, coc.nvim provides an autocomplete feature that many (including me) find useful. This feature allows several sources of completion candidates, including the omni complete function from VimTeX (which is made available with the coc-vimtex extension). But, and important: coc.nvim does not work the same way as regular omni completion. Instead, it loads/caches all completion candidates with an empty query, then filters the candidates with its own mechanism (e.g. it allows fuzzy matching). But it only matches on the actual completion candidate. Note: I don't know the details on how this works, but this description should be close enough.

The :checkhealth warning is not relevant to your question - for more info on that, see :help vimtex-faq-neovim.

6
  • Hm well this doesn't look good for me, but I have to admit, I had texlab installed before testing and recording this. As I didn't needed coc-texlab anymore I deinstalled it and recorded this afterwards. But somehow now (after some time) I cannot even get citation completion from (coc-)vimtex. After entering \cite{ I get completion for the entries of the .bib but when continuing to type the completion vanishes (even if I just start typing the key of the entry). When reinstalling texlab the completion as in the gif is present again. Sorry for the confusion, but can you help?
    – atticus
    Apr 29, 2021 at 12:13
  • (or should this be an issue on your github?)
    – atticus
    Apr 29, 2021 at 12:14
  • @atticus I'm also using vimtex, but together with coc-texlab. I don't know if it's recommended, but this mix-n-match gives me better experience than using coc-vimtex.
    – Gordon Bai
    Apr 29, 2021 at 13:01
  • Well but by using coc-texlab I have this weird behaviour as shown in the initial post. And to be honest as far as I read the vimtex docs this is exactly the behaviour I want
    – atticus
    Apr 29, 2021 at 14:43
  • 2
    I think this discussion is better continued in a GitHub thread. Apr 29, 2021 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.