I noticed that in the past I produced several posts about combining LaTex and Emacs. While I do like Emacs and respect it’s formidable power I do not consider myself an Emacs user. Most of my day-to-day work is done in Vim which brings different kind of editing power to the table. Emacs is a lisp based framework for building text editing applications – fully programmable, easily customizable and almost endlessly extensible. The power of Emacs comes from what it can do. Vim’s power stems from what it does – and that is providing very powerful and yet simple modal text editing environment. I wanted to say intuitive, but yeah – that would be a lie. Vim is powerful because it allows you to accomplish just about anything in 3-4 keystrokes by chaining and combining simple commands.

Using Vim makes editing text much simpler and easier. It removes a lot of key-presses and movements. Let me give you an example – in a typical coding session you may want to copy the current line, and paste it below. Assuming your cursor is in the middle of the line how would you go about accomplishing it? Typically you would do:

Hit Home to skip to the beginning of the line Hold shift and hit End to highlight the line Press Ctrl+C to copy the line Hit End again to put the cursor at the end of the line Hit Enter to insert a new line Press Ctrl+V to paste the line

How do you do it in Vim?

Press the following keys in a sequence: yyp

That’s it. You want to paste the line 3 times? Do yy3p. This is the power you get when you use Vim. Of course die-hard emacs fanboys will remind me that one could always use Emacs’ VIP mode which emulates vi’s modal editing features. And they would be absolutely right. As I said, Emacs is a framework for building editors rather than an editor. So when you launch it in VIP mode you are really using Vi with the lisp powerhouse underneath it.

In theory you could combine the neat features of AUCTex on Emacs and the power the VIP mode gives you to get the best of both worlds. But if you don’t need these features – if you are a Vim purist or if you just need a simple modal text editor I have a nice alternative for you. It’s called VimLaTex.

While it does not have the nice rendering features of AUCTex, VimLaTex is a must-have if you are planning to use Vim to edit LaTex files. The package itself is tiny – you just drop few hundred KB into your .vim directory and add few lines to your .vimrc.

The suite will add bunch of useful menus to your toolbar:

These menus are your standard IDE like features – for example options for inserting packages, or snippets of code for special environments and etc.. A lot of the entries come with predefined key-bindings which make your life much easier. For example:

To compile your file do: \ll To view compiled file do: \lv

You can set the preferred format for both options above by invoking :TTarget. It works like a charm both on Windows and Linux when I tried it.

VimLaTex also uses an interesting concept of placeholders. Whenever you use it to generate snippet of code, it will put funny looking character sequences inside of it. They may look silly until you realize how useful they are. For example let’s say you want to insert a figure:

\begin{figure}[h] \centerline{\psfig{figure=«eps file»}} \caption{«caption text»} \label{fig:«label»} \end{figure}«»

The placeholders are there to make your life easier. When you press Ctrl+J vim will jump to the first «» delimited sequence and select it. This way you can just type over it. Press Ctrl+J again (while still in insert mode) and you will jump to the next one. How awesome is that?

If you are a Vim lover who also happens to use LaTex or a LaTex user who loves Vim definitely check this one out.