Closed wbthomason closed 7 years ago
This feature is already there. But it won't work too well with other completion engines. Vimtex provides an omni completion where the leading part that is to be completed is tried as a regular expression against the bibliography entries. E.g., with the following bib entry:
@Article{Sussman94,
author = {M. Sussman and P. Smereka and S. Osher},
title = {A level set approach for computing solutions to
incompressible two-phase flow},
journal = {Journal of Computational Physics},
volume = {114},
pages = {146-159},
year = {1994},
}
You can complete with \cite{A level set<c-x><c-o>
, and it will complete the Sussman94
entry.
As an extra note: To make this feature work smooth with autocompletion plugins (neocomplete/deoplete/youcompleteme/nvimcompletionmanager/etc) is not possible (I think), because the typed text that you want to complete does not correspond to the desired resulting text. However, if you do not automatically insert autocompleted entries, the above mentioned approach should still work.
Ah, this would explain why I couldn't seem to make this sort of completion work. Thank you for the tip!
No problem :)
It would be useful for vimtex's citation completing support to include the titles of bibliography entries in the text searched for a completion match. This would e.g. make it easier to cite a paper based on the topic or title rather than having to look up the author.
I've looked briefly at adding this to https://github.com/lervag/vimtex/blob/master/autoload/vimtex/complete.vim#L126, and would be willing to make a PR for this feature if it's something that's desirable for vimtex. I suspect that it would be a simple change, but my vimscript-fu is weak, and so I haven't gotten it working yet.