question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recent commits broke omnifun autocompletion with vimtex

See original GitHub issue

Before commit 22d80bc0b93c942eeb07d9c5cbd2ae6927d3cd64, the following setup correctly autocompleted:

minimal vimrc

call plug#begin('~/.vim/plugged')
Plug 'roxma/nvim-yarp'
Plug 'ncm2/ncm2'
Plug 'lervag/vimtex'
call plug#end()

au BufEnter * call ncm2#enable_for_buffer()
au User Ncm2Plugin call ncm2#register_source({
            \ 'name' : 'vimtex',
            \ 'priority': 1,
            \ 'subscope_enable': 1,
            \ 'complete_length': 1,
            \ 'scope': ['tex'],
            \ 'mark': 'tex',
            \ 'word_pattern': '\w+',
            \ 'complete_pattern': g:vimtex#re#ncm,
            \ 'on_complete': ['ncm2#on_complete#omni', 'vimtex#complete#omnifunc'],
            \ })
set completeopt=noinsert,menuone,noselect

test files

test.bib (needs to be in the same directory)

@article{A1,
  author = {Author, A.},
  journal = {Good Journal},
  year = {2001},
  title = {Alpha},
}
@article{A2,
  author = {Author, A.},
  journal = {Very Good Journal},
  year = {2008},
  title = {Bravo},
}
@article{B3,
  author = {Buthor, C.},
  journal = {Also Good Journal},
  year = {2004},
  title = {Charlie},
}

test.tex (the main file)

\documentclass{article}
\begin{document}

\bibliographystyle{plain}
\bibliography{test.bib}
\end{document}

steps to reproduce

First problem:

  1. nvim -u vimrc test.tex
  2. in the empty line after \begin{document}, type \cit
  • expected: ncm2 suggests \cite (same as <c-x><c-o>)
  • observed: nothing happens

If I revert to 7feca385009bc62a844b8ffa98119edc7a2f8667, autocomplete works here as expected.

Second problem:

  1. nvim -u vimrc test.tex
  2. in the empty line after \begin{document}, type(!) \cite{A

Important: do not let ncm2 complete the \cite command! Otherwise the issue won’t occur.

  • expected: ncm2 suggests A1 and A2 (same as <c-x><c-o>)
  • observed: nothing happens

Note: just typing \cite{ does suggest A1, A2, B1 as expected; it’s just the further filtering that no longer works. If I revert to 0fd55917436284c429d9895ce2ac42e8902d3bf5, the filtering works as expected.

os

This happens with neovim release 0.3.0 as well as v0.3.1-180-g487421413, on macOS as well as Linux.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
clasoncommented, Jul 14, 2018

Still works!

0reactions
clasoncommented, Jul 14, 2018

You’re right, this would even better – but now it no longer completes based on the author string (\cite{A|)? (EDIT: and neither does \ci complete to \cite.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation for ncm2 · Issue #1160 · lervag/vimtex - GitHub
I am still struggling to get vimtex completion working here. ... Recent commits broke omnifun autocompletion with vimtex ncm2/ncm2#22.
Read more >
vimtex.txt - GitHub
VimTeX maintains a list of latex packages that are required by the current project. This list is used by VimTeX for instance to...
Read more >
non latin identifier based autocompletion - vim - Stack Overflow
I dont want any complicated completion as i understand that it is nearly impossible with the current implementation of vim.
Read more >
neovim/neovim - Gitter
I get some strange behaviour sometimes where nvim just forgets parts of my config, and all of a sudden tabs are tabs instead...
Read more >
vimrc · master · mtrame / vim-config - EECS Gitlab
Show partial commands in the last line of the screen ... Allow backspacing over autoindent, line breaks and start of insert action.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found