views:

103

answers:

3

How can I use Latex effectively in VIM?

Is there a way to configure compile errors by highlighting the line in vim?

I have syntax highlight. What are other recommended add-ons? Is a makefile the recommended way to compile a latex file to pdf?

TexWorks lets you open and replace the opened pdf everytime it's recompiled. Is there a plugin to do something similar in vim?

+2  A: 

check out vim latex

If you use vim latex put the following in your .vimrc:

let g:Tex_DefaultTargetFormat='pdf'

and it should compile to pdf by default. (I think the default compilation key is \ll).

skeept
what exactly is the "\ll" key?
verhogen
I mean, you hit \ll (three keys) to compile the document.
skeept
+1  A: 

vim-latex is great. But I found it too heavyweight for my tastes. I prefer more of a "Vim with LaTeX compile & view" approach, rather than "A LaTeX IDE with Vim key-bindings". So I rolled my own: 'TeX-PDF: Lightweight "stay-out-of-your-way" TeX-to-PDF development support'.

Also check out: "LaTeX Help : Help for LaTeX in vim.help format" for calling up help of LaTeX from within Vim.

Jeet
I tried you plugin, it is simplistic but gets the job done (compiling and viewing).
skeept
Quick note, the extension of the file should be .bz2 not .gz. Thanks.
skeept
Thanks. New version has compression matching the extension.
Jeet
A: 

I've just begun playing around with LaTeX-Box. It seems like a good plugin. I, also used VIM-LaTeX for a while, but I didn't really like the key mappings, and it seemed a bit to heavyweight as Jeet described.

I like LaTeX-Box so far because it used latexmk to compile, which is what I was using anyway. Latexmk will sit in the background and watch your .tex file for changes, and then automatically compile for you. And if you use a pdf viewer which refreshed changes (such as evince on Linux) you can see updates every time you change. Adding

let g:LatexBox_latexmk_options = "-pvc -pdfps"

to my .vimrc got latexmk working properly. You also need the latexmk script somewhere on you PATH. The key mapping to start latexmk is the same as Vim-Latex's compile: '\ll' (that's lowercase LL).

I also use SuperTab plugin for completions, which is great. And I took the dictionary files from Vim-LaTeX so I have a ton of auto completion words to use. This dictionary file is: ftplugin/latex-suite/dictionaries/dictionary in the vim-latex files. What I did was copy this file into ~/.vim/dictionaries/ and renamed it 'tex' then I added these lines to my .vimrc file:

set filetype on
au FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))
set complete+=k

Then if I type the beginning of a latex command and hit 'tab' I will get a list of completions. Pretty handy. BTW that 'au' command in the vimrc will also load dictionaries for any other filetypes if you want. A useful trick.

And I can only post the one hyperlink, since I'm still a new user. latexmk can be found here: www.phys.psu.edu/~collins/software/latexmk-jcc/

MrException