asyncrun.vim icon indicating copy to clipboard operation
asyncrun.vim copied to clipboard

texcompiler latexmk is not working properly

Open rudrab opened this issue 5 years ago • 6 comments
trafficstars

Hi, I use asyncrun to run and compile all my codes, as:

" AsyncRun {{{
" Quick run via <F10>
nnoremap <F10> :call <SID>compile_and_run()<CR>
inoremap <buffer> <F10> <Esc> :call <SID>compile_and_run()<CR>
function! s:compile_and_run()
  exec 'w'
  if &filetype == 'c'
    exec "AsyncRun! gcc % -o %<; time ./%<"
  elseif &filetype == 'fortran'
    exec "AsyncRun! gfortran -Wall % -o %<; time ./%<"
  " elseif &filetype == 'tex'
   " exec "AsyncRun!  latexmk -pdflatex=lualatex -pdf -interaction=nonstopmode -pv -quiet -synctex=1 -shell-escape %"
  elseif &filetype == 'sh'
    exec "AsyncRun! time bash %"
  elseif &filetype == 'python'
    exec "AsyncRun! time python3 %"
  endif
endfunction
let g:asyncrun_open = 15
"}}}

But, while this is working well for fortran or sh or python, tex is not working properly.
Instead of asyncrun, if I use it normally as: au FileType tex nnoremap <buffer> <F10> :up!<cr>:! latexmk -pdflatex=lualatex -pdf -pv -quiet -synctex=1 -shell-escape %<CR><Esc> then it is working as intended. Please let me know how to use it.

rudrab avatar Jun 21 '20 14:06 rudrab

"not working properly" ? what's that exactly ? any error output ?

skywind3000 avatar Jun 21 '20 22:06 skywind3000

Error is "Backgrond job is still running". Actually, it comes and goes so fast in gvim's quickfix window, its hard to check.

rudrab avatar Jun 22 '20 05:06 rudrab

Has it started any desktop gui app which is still running in the background ??

Did you see any

[Finished in xx seconds]

message in the quickfix window ?

skywind3000 avatar Jun 22 '20 09:06 skywind3000

The latexmk -pv opens evince, and it is persistance in the background.

rudrab avatar Jun 22 '20 10:06 rudrab

So, the background job is still running, you can fixed it by starting evince before this.

skywind3000 avatar Jun 23 '20 03:06 skywind3000

While I can definitely do that, I was looking for some way to use <Esc>, as I have done in my au command, which is working.

rudrab avatar Jun 23 '20 03:06 rudrab