The Vim LaTeX-suite includes a number of predefined LaTeX environments, including the obsolete¹ eqnarray and eqnarray* environments. I want to get rid of every last shadow of these environments in the LaTeX-suite. How do I do that (and replace them by other environments)?

¹ e.g. see Avoid eqnarray! (PDF)

  • 1
    Although you've probably heard this before, vim-latex is an extremely large and convoluted plugin that's deceptively challenging to modify in reasonable ways. So the easy answer is "ignore it". The longer answer is: make changes to ftplugin/outline.py,envmacros.vim,wizardfuncs.vim,texrc,dictionaries/dictionary. If you search and remove every instance of eqnarray, latex-suite will continue to work and will omit eqnarray. Adding your own wouldn't be too dissimilar to replacing each instance of eqnarray with align (or your desired environment). Commented Feb 4, 2015 at 8:58
  • @mixedmath In fact I haven't heard anything about vim-latex. Are you saying it's better to "write my own plugin"? So far vim-latex has syntax highlighting, predefined environments, auto-completion and key bindings for compilation. How much work would it be to replicate these features from scratch? (I don't mind typing, so I could live without auto-completion.)
    – Earthliŋ
    Commented Feb 4, 2015 at 9:16
  • Are you asking about how to neuter the Vim-LaTeX plugin so that it no longer supports eqnarray? Or are you asking about how to expunge eqnarray from all your existing documents the next time you open them? Or something else? Commented Feb 4, 2015 at 9:33
  • No, I wouldn't recommend writing your own plugin. I'm not quite sure what you're quoting from there, either. There are a variety of latex plugins. latex-suite is known to integrate poorly with other plugins and is a pain to modify. It redefines a bunch of syntax regions that override the regions used by other plugins. It also has more functionality than anyone uses, and cannot be toggled off. For what it's worth, the README on lervag/vim-latex (which is not latex-suite/the vim-latex you're mentioning) links to the 4 most common latex plugins. Commented Feb 4, 2015 at 9:40
  • 3
    @200_success I don't see how it is bad, it satisfies all requirements IMHO: It's on-topic (vim plugin), well stated now (make latex-suite forget what eqnarray is), applicable to general situation (if someone else wants the same thing, they should be able to use the solution to this specific one).
    – yo'
    Commented Feb 4, 2015 at 10:43

2 Answers 2


While infuriating, a number of vim-latex's features can be customised without editing the source code.

Disable the EEA mapping

In .vim/after/ftplugin/tex.vim, add

call IMAP('EEA', 'EEA', 'tex')

Typing EEA in insert mode will no longer insert the eqnarray environment.

F5 prompted environments

In .vim/ftplugin/tex/texrc, add:

let g:Tex_PromptedEnvironments = 'equation,\[,align,align*'

This removes eqnarray and some of the other discouraged/redundant environments from the F5 prompt. Of course, you can add your own environments here as well.

^F1-^F4 keybindings

There are also keybindings for ^F1 through to ^F4. In .vim/ftplugin/tex/texrc, add

let g:Tex_HotKeyMappings = 'bmatrix'

Again, you can customise this to suit your needs. (bmatrix is one of vim-latex's defaults.)


If you just want to remove all the eqnarray's in the source, first run an ack or a recursive grep or sed in your own personal fork of the github repo to find all occurrences of the word, so:

$ cd $vim_latex_dir
$ ack 'eqnarray'

You'll observe that 5 document files have it, as well as the ftplugin files:


This is where the surgery happens--you'll need to go to the line numbers of the occurrences in each file and examine the extent of the cancer--what I mean by this is that in some files you can simply remove the entire line of the match, whereas in other places you may need to remove/alter an entire function or very precisely alter a part of a line.

Regardless, if you proceed to do as described above and manage to remove all the eqnarrays, you'll have your own version of vim-latex that no longer recognizes eqnarray.

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.