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

  • 3
    Now I've seen everything; long-time Emacs user converting to Vim! :-) How did the joke go: "vi is a good text editor, emacs is a program to make good text editors"? I'm not sure if it related to vim-latex, but there was some setting like let g:tex_flavor=latex, where it would default to plain IIRC.
    – morbusg
    Commented Sep 13, 2012 at 16:46

2 Answers 2

  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.

  • 1
    Just a small update to point 3: The latest set of commits to the LaTeX-Box repository have significantly improved the indentation, to the point where it now correctly indents everything I throw at it. Commented Sep 26, 2012 at 6:46
  • 2
    By the way, using the pathogen plugin, you can simply clone the LaTeX-Box (and SnipMate) repository under .vim/bundle and then update in place. Very convenient. Commented Sep 26, 2012 at 6:49

I can recommend Automatic LaTeX Plugin, it includes LatexBox, but extends its tools in various ways and contains much more useful stuff. You can see its feature list. Automatic LaTeX Plugin has an excelent completion, which makes writing LaTeX code extremely fast. It can also compile documents when you write them, so there is no need of actually running any command to compile the document. It works very fast with small files, when the LaTeX is fast.

Ad. preview mode: you cannot get it in vim nor in gvim. Vim (gVim) is just a text editor, and you cannot include graphic files in the window. Though, as already notes the conceal feature might give some experience like you wish to have (showing α instead of \alpha, etc ...)

It also has gW command to reformat the current paragraph (it breaks the paragraph at right places, like environments, displayed math, etc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .