You are not logged in.

#1 2018-09-23 15:04:35

Mladia
Member
Registered: 2016-04-30
Posts: 59

[Solved] Running vim-latex compile in the background

I am using a plugin called vim-latex (latex-suite) to compile LaTeX file directly in bim. I want that my LaTeX code compiles in the background, so I don't see the output and I can edit the file in vim in the meantime. I followed some other questions and so far I have got this:


    noremap <leader>mm :AsyncMake<cr>
    :autocmd BufEnter *.tex let &makeprg="latexmk -e '$pdflatex=q/pdflatex -synctex=1 -interaction=nonstopmode/' -pdf ".expand("<amatch>")
    let g:Tex_DefaultTargetFormat = 'pdf'
    let g:Tex_FormatDependency_pdf = 'pdf'
    let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 --interaction=nonstopmode $* '

`\ll` compiles the latex file, but I have to wait for the compile to be over so I can continue editing my file and also I see the output on the whole screen.

I can press `\mm` and my code compiles in the background, but it doesn't use the default vim-latex command, so when I am not in the main.tex and call `\mm` I get errors (vim-latex handels that on it's own well). On the other hand, if I press `\ll` in the secondary file, everything compiles correcty (but I have to wait to compile).

`\ll` calls

 \ll          @<Plug>Tex_Compile 

Is there a way to bind that command, so that it runs with this Async thing, or something else, if it's better.

Last edited by Mladia (2018-09-23 20:57:56)

Offline

#2 2018-09-23 15:44:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,578
Website

Re: [Solved] Running vim-latex compile in the background

I don't know anything about the 'vim-latex' plugin, I never saw any point in such things as they hide very very simple processes behind a load of complexity.  I just bind a key to a latexmk command.  If you wanted to run latexmk in the background and return to your document, you'd just bind a key to `latexmk &`.

In my case, my binding is the following (this is not backgrounded):

nmap <F5> ;w<CR>;silent !latexmk -quiet -pv "%"; latexmk -c "%"<CR><CR>;redraw!<CR>

To remove the preview, the 'write', and to background it (and to use the default : prefix):

nmap <F5> :silent !latexmk -quiet "%" &<CR>:redraw!<CR>

Last edited by Trilby (2018-09-23 15:47:16)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-09-23 17:34:16

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Running vim-latex compile in the background

Mladia wrote:

but I have to wait for the compile to be over so I can continue editing my file and also I see the output on the whole screen.

This can be quite helpful when the compile fails and prints a helpful error message...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2018-09-23 20:57:16

Mladia
Member
Registered: 2016-04-30
Posts: 59

Re: [Solved] Running vim-latex compile in the background

Well, that worked also. I redirect the output to copen

Last edited by Mladia (2018-09-23 21:10:37)

Offline

Board footer

Powered by FluxBB