vimtex icon indicating copy to clipboard operation
vimtex copied to clipboard

Experience delay after "compilation complete" if g:vimtex_view_automatic is on

Open arvyanh opened this issue 5 years ago • 5 comments

Basically, if I do :VimtexCompile with let g:vimtex_view_automatic=1, then I'll experience a ~3 s period where I couldn't edit the vim file (basically, if i type left arrow I'll see the ^[OC on the screen) until the pdf is started.

However, doing :VimtexCompile without g:vimtex_view_automatic on and run :VimtexView after it works just fine (and even faster).

Is it possible for me to know what exactly is running during that time period?

arvyanh avatar Dec 19 '20 23:12 arvyanh

Basically, if I do :VimtexCompile with let g:vimtex_view_automatic=1, then I'll experience a ~3 s period where I couldn't edit the vim file (basically, if i type left arrow I'll see the ^[OC on the screen) until the pdf is started.

However, doing :VimtexCompile without g:vimtex_view_automatic on and run :VimtexView after it works just fine (and even faster).

Is it possible for me to know what exactly is running during that time period?

Yes and no: If you read the source code, you can of course know exactly what is running.

My guess is that the delay is caused by some code that looks for the xwin ID of the viewer you use. To help further, it would be useful if you could provide detals as asked in the issue template: The output of :VimtexInfo contains a lot of the useful info. In addition, it can help to know the rest of your configuration details.

lervag avatar Dec 20 '20 12:12 lervag

And it seems changing pdf viewer from Zathura to Mupdf make this process a lot faster

And here is the :VimtexInfo output:

System info
  OS: Ubuntu 20.04.1 LTS
  Vim version: VIM 8.2 (1-2039)
  Has clientserver: true
  Servername: undefined (vim started without --servername)

vimtex project: test
  base: test.tex
  root: /home/arvyanh/Documents/notes/1_notel/CS/language/latex
  tex: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.tex
  out: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.pdf
  log: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.log
  aux: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.aux
  fls: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.fls
  main parser: current file verified
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
    job: process 8269 run
    pid: 8269
    cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -view=none -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'test.tex'
  viewer: Zathura
    xwin id: 0
  qf: LaTeX logfile
    root: /home/arvyanh/Documents/notes/1_notel/CS/language/latex
    addqflist: 65
    errorformat_saved: 
    fix_paths: 66
    main: /home/arvyanh/Documents/notes/1_notel/CS/language/latex/test.tex
    set_errorformat: 64
  document class: report
  packages:
    amsbsy
    amsfonts
    amsgen
    amsmath
    amsopn
    amssymb
    amstext
    bm
    calc
    epstopdf-base
    esint
    fullpage
    graphics
    graphicx
    keyval
    listings
    lstlang1
    lstmisc
    mathrsfs
    mathtools
    mhsetup
    trig

arvyanh avatar Dec 21 '20 01:12 arvyanh

To help further, it would be useful if you could provide detals as asked in the issue template: The output of :VimtexInfo contains a lot of the useful info. In addition, it can help to know the rest of your configuration details.

It seems you missed the final part?

I notice you are running Vim without the clientserver. Do you have xdotools installed?

Can you make a minimal example as explained in the issue template?

lervag avatar Dec 21 '20 16:12 lervag

a minimal latex example would be just a minimal latex, Since the issue occurs after the compilation


\documentclass[11pt]{report} %article do not have *part* and *chapter*

\title{title}
\author{name} 

\begin{document}
	
\end{document}

And I've tried to start with client-server and it doesn't solve the issue (I had the xdotools installed)

deleting all plugin related .vimrc entries doesn't solve the issue.

I do suspect this is related to Zathura or some of my own system settings since changing to mupdf is a lot faster.

In that case, maybe I'll just close the issue

arvyanh avatar Dec 22 '20 02:12 arvyanh

A fully minimal example also involves a minimal vimrc. For instance, the following might work:

" test.vim
set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable

let g:vimtex_view_method = 'zathura'
% test.tex
\documentclass{minimal}
\begin{document}
Hello world!
\end{document}

Now, in a terminal, do vim --servername VIM -u test.vim test.tex and test. Do you still observe the delay?

lervag avatar Dec 22 '20 09:12 lervag