Movement and actions using ) and ( are very powerful: I use them all the time. However, when writing and editing LaTeX, I have run into the following problem: vim cannot recognize the end of some LaTeX sentences. For example:

This is a test. This is only a test. Instead, according to Gottlieb, Socrates
has two audiences, the in-crowd and the outsiders.\footcite[][278]{gottlieb-1992}
The in-crowd know what Socrates means, but Socrates deceives the outsiders. I am
still testing. Test?\footcite[Blah, blah][456]{gottlieb-1992} Moar testing.

Can you see it? The end of the first sentence is, well, kind of at outsiders., which is right before \footcite. But really the sentence ends after the citation {gottlieb-1992}. Either way, it's a moot point: vim thinks that the third and fourth sentences are one sentence. The same goes for the last two sentences: vim sees them as one sentence. The problem, I think, is that the end of sentence (. or ?) is hidden by \footcite.

tl;dr: sentence endings in LaTeX can involve citations after the final punctuation. As a result, vanilla {neo,}vim cannot handle them. Does anyone know of a trick or a plugin to help vim deal with them?

  • Vim detects sentences as described in :help sentence; what if you put the \footcite{...} command before the closing .? It won't help if your footnote contains a full sentence, but... I believe there is also a way to separate the \footcite from the actual text of the footnote?
    – D. Ben Knoble
    Commented Mar 21, 2020 at 17:43
  • By default, if I put the citation before the period, then the number will appear before the period. That's not an acceptable outcome for me, but you are right that I can investigate ways to separate the placement of the citation and the placement of the note.
    – Telemachus
    Commented Mar 21, 2020 at 21:29

2 Answers 2


There is a plugin that helps: vim-textobj-sentence. It replaces vim's built-in ) and (, and it does a better job on many LaTeX sentences. However, it also has some issues of its own. For example, it doesn't recognize sentences within parentheses. (I'm putting this here for people who find this question via Google, but I'm not going to accept this answer yet.)


That depends on what causes Vim to think that the sentence ends at another spot than what you intend. You could have a look at the csquotes package. http://ftp.lyx.org/pub/tex-archive/macros/latex/contrib/csquotes/csquotes.pdf

  • I'm not sure I follow. Can you say a bit more about why you think csquotes would help?
    – Telemachus
    Commented Mar 19, 2020 at 21:54
  • I thought that Vim might get confused by all the quotes. By using an environment that sets them (effectively replacing the quotes with braces in the source) the situation might be alleviated. Or have you tried using typographic quotes? “ ” I use Xelatex and use only those. Commented Mar 20, 2020 at 7:50
  • Ah, I see. Unfortunately, the problem is not the quotations. I've updated my question to clarify. Even if I remove all the quotations, the problem remains. Thanks for your suggestion, though.
    – Telemachus
    Commented Mar 20, 2020 at 12:55

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.