[Tex/LaTex] How to use MacVim for LaTeX

auctexemacsvim

I'm a long-time Emacs+AUCTeX user (I even once wrote a short tutorial for it!), but for a couple of different reasons (problems maintaining my Emacs configuration, the beauty of Drew Neil's voice, and simply embracing the uncomfortable) I began looking at (Mac)Vim. As far as general Vim usage is concerned, I can always consult numerous online resources, but it seems that not so many people are using Vim for LaTeX.

So to anyone who's using Vim for editing TeX files, here are my questions:

  1. Which plugins do you recommend? I've been trying LaTeX-Box and it seems nice, but perhaps there are better solutions?
  2. Is there something similar to AUCTeX's Preview-mode offered by any Vim plugin?
  3. Is there a way of automatic formatting/indentation of LaTeX code similar to AUCTeX's C-c C-q C-s? Vim's indentation commands don't seem to work properly, or perhaps I just don't know how to use them properly.

I'm happy to hear any advice about the points above, because I'd really like to switch to Vim. I find it quicker, easier to configure (and maintain configuration) and more powerful. It's just that 10 years of AUCTeX habits are hard to get rid off.

cheers;
Piotr

Best Answer

  1. My favorite is in fact LaTeX-Box: It has all the features I need (autocomplete for references and citations, automatic compilation) and is still quite lightweight (compared to vim-latex). A good companion plugin is SnipMate, which offers quite a few LaTeX specific shortcuts (e.g., typing eq and hitting the tabulator key will replace it with \begin{equation} \end{equation} and place the cursor between the two).

  2. I don't know anything quite as fancy, but there is the conceal feature introduced with Vim 7.3. I find it is more distracting than helpful (but then, I feel the same way about Preview-mode).

  3. I'm actually quite happy with Vim's indentation (gg=G, make sure you have filetype plugin indent on in your .vimrc), even if there are some things it could handle better. There's also a separate indent file for TeX, although I have no experience with this.


UPDATE: I've since switched to vimtex (a well-maintained fork of LaTeX-Box) and vim-plug and couldn't be happier.

Related Question