skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.84k stars 109 forks source link

texcompiler latexmk is not working properly #196

Open rudrab opened 4 years ago

rudrab commented 4 years ago

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.

skywind3000 commented 4 years ago

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

rudrab commented 4 years ago

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

skywind3000 commented 4 years ago

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 ?

rudrab commented 4 years ago

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

skywind3000 commented 4 years ago

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

rudrab commented 4 years ago

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.