I just started using Vim-LaTeX
.
The default dvi
output didn't work for me, so I changed the default to pdf
by adding "let g:Tex_DefaultTargetFormat = 'pdf'"
to my tex.vim
.
The only problem is that I need to save my document first (:w
) before compiling it (\ll
) and viewing in in Evince (\lv
). If I do not save it, and run \ll
and \lv
, latex is run on the saved file before I started editing it, and not on the buffer containing my edited file.
How do I make it so that vim saves my file and compiles my document when I hit \ll
? Thanks!
this is not the perfect solution but it will work, define a new map in your .vimrc:
map <f2> :w<cr><leader>ll
this works but there should exist a cleaner way of doing this.
This does specifically what you asked. Add the following to your .vimrc
or equivalent:
autocmd FileType tex call Tex_MakeMap("<Leader>ll", ":w <CR> <Plug>Tex_Compile", 'n', '<buffer>')
autocmd FileType tex call Tex_MakeMap("<Leader>ll", "<ESC> :w <CR> <Plug>Tex_Compile", 'v', '<buffer>')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With