开发者

How do I make vim-latex compile correctly without having to save?

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>')


I have since moved on from latex suite and i am now using latexmk which works really well.


@dc46and2 Your command should be:

autocmd FileType tex call Tex_MakeMap('<leader>ll', ':update!<CR>:call Tex_RunLaTeX()<CR>', 'n', '<buffer>')
autocmd FileType tex call Tex_MakeMap('<leader>ll', '<ESC>:update!<CR>:call Tex_RunLaTeX()<CR>', 'v', '<buffer>')

AFAIK, " are used for comments in vim.


You can try:-

:w | !pdflatex "filename"

I believe this will work fine in your case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜