Are there any good alternative plugins that someone has put together for working with latex in vim?

I use the vim-latex latex suite, but it's a bit much. I'm pretty sure I use maybe 10% of the features - and I don't really like some of the design choices. However, it is much better than nothing. I'd just like something more lightweight, with just a few basic macros, code highlighting, folding, compiling, etc.


1 Answer 1


An alternative is one tool for one job :

Code highlighting : just vim

In .vimrc : syntax on

Folding : just vim

In .vimrc : set fdm=marker
Commands : zc, zo, zr, zm.
I open and close a section with %{{{1 and %}}}, a subsection with %{{{2 %}}}. A long TikZ code goes in %{{{ and %}}}= so it is immune to zr or zm.

Spell checking : just vim

In ftplugin/tex.vim (filetype plugin on in .vimrc):
setlocal spell
In normal mode:
- zg (add Good word to local dict.).
- zw (remove wrong word from local dict.)

Compiling 1 : just vim8.1

:term latexmk -pdf -pv %

Compiling 2 : latexmk (in tmux using Dispatch in vim)

  1. When pressing <LocalLeader>L, latexmk compiles in the background and the pdf shows up on success. On failure, I press :Copen to view the error messages in a vim split.
  2. When pressing <LocalLeader>l, latexmk spits out its output in a vim split (actually in a tmux split during compilation) and the pdf shows up.

Here are the commands in ftplugin/tex.vim:

nnoremap <LocalLeader>l :w<CR> :Dispatch  latexmk -pdf -pv -halt-on-error %<CR>
nnoremap <LocalLeader>L :w<CR> :Dispatch! latexmk -pdf -pv -halt-on-error %<CR>

Code checking / Linting : ALE (using chktex)

In ftplugin/tex.vim (filetype plugin on in .vimrc) :

execute "packadd ale"
let b:ale_fixers = ['remove_trailing_lines',  'trim_whitespace']
let b:ale_linters = ['chktex’]

NOTE: To ignore the error type 6 at a particular line, I add that to its end % chktek 6

Grammar checking : vim-grammarous

In ftplugin/tex.vim (filetype plugin on in .vimrc):

execute "packadd vim-grammarous"
nnoremap <LocalLeader>g   :GrammarousCheck --lang=fr<CR>
vnoremap <LocalLeader>g   :'<,'>GrammarousCheck --lang=fr<CR>
nnoremap <LocalLeader>G   :GrammarousReset<CR>
  • How you have managed to use vim-grammarous with latex? it check syntaxes also, and gives error there, right from \documentclass.
    – BaRud
    Jun 23, 2020 at 19:03

You must log in to answer this question.

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