lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.52k stars 389 forks source link

Compilation disrupt work #1597

Closed eyalk5 closed 4 years ago

eyalk5 commented 4 years ago

Issue It compiles when the file is saved. The problem is when it compiles, it gets out of visual mode and insert mode. Thus it disrupts continuous work. I sometimes save and want to do somethings quickly and it fails. it compiles the document when the document is saved(by my configuration).

Cant compilation be executed completely in background?

reproduce

  1. Open big tex doc.
  2. nmap Y :w<CR>
  3. press \ll (wait for compile)
  4. do a single change in doc (delete char)
  5. press Y
  6. press v (shortly after)
  7. wait two seconds - you will be off visual mode

I expect it not to get out of visual mode, but to execute in the background.

configuration

set updatetime=3000
let g:vimtex_complete_recursive_bib = 1
let g:vimtex_fold_enabled = 1
let g:vimtex_view_method = 'skim'
let g:vimtex_compiler_progname = 'nvr'
let g:vimtex_compiler_latexmk = {
    \ 'backend' : 'nvim',
    \ 'background' : 1,
    \ 'build_dir' : '/tmp/builddir',
    \ 'callback' : 1,
    \ 'continuous' : 1,
    \ 'executable' : 'latexmk',
    \ 'options' : [
    \   '-pvc',
    \   '-shell-escape',
    \   '-verbose',
    \   '-file-line-error',
    \   '-synctex=1',
    \   '-interaction=nonstopmode',
    \ ],
    \}

vimtexinfo

System info
  OS: Mac OS X 10.13.6 (17G65)
  Vim version: NVIM v0.5.0-295-g234232ff4
  Has clientserver: true
  Servername: /var/folders/rr/ht4whxv978xdd88mlqhy44br0000gn/T/nvimR2BFju/0

vimtex project: newzig3
  base: newzig3.tex
  root: /Users/eyalkarni/thesisnew
  tex: /Users/eyalkarni/thesisnew/newzig3.tex
  out: /tmp/builddir/newzig3.pdf
  log: /tmp/builddir/newzig3.log
  aux: /tmp/builddir/newzig3.aux
  fls: /tmp/builddir/newzig3.fls
  compiler: latexmk
    backend: nvim
    output: /var/folders/rr/ht4whxv978xdd88mlqhy44br0000gn/T/nvimR2BFju/2
    configuration: 
      continuous: 1
      callback: 1
      build_dir: /tmp/builddir
      latexmk options:
        -pvc
        -shell-escape
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
    pid: 63928
    cmd: max_print_line=2000 latexmk -pvc -shell-escape -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -outdir=/tmp/builddir -pvc -view=none -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'newzig3.tex'
  viewer: Skim
    process: 
      pid: -
      cmd: osascript -e 'set theFile to POSIX file "/tmp/builddir/newzig3.pdf"' -e 'set thePath to POSIX path of (theFile as alias)' -e 'tell application "Skim"' -e 'try' -e 'set theDocs to get documents whose path is thePath' -e 'if (count of theDocs) > 0 then revert theDocs' -e 'end try' -e 'open theFile' -e 'end tell' >/dev/null 2>&1 &
  qf: LaTeX logfile
    config: 
      ignore_filters:
        .*Warning.*
      font: 1
      references: 1
      overfull: 1
      general: 1
      packages: 
        biblatex: 1
        babel: 1
        default: 1
        hyperref: 1
        general: 1
        natbib: 1
        scrreprt: 1
        fixltx2e: 1
        titlesec: 1
      underfull: 1
      default: 1
  document class: amsart
lervag commented 4 years ago

Please read the issue template and provide some more details. I can't reproduce this.

eyalk5 commented 4 years ago

Is it OK now?

lervag commented 4 years ago

Is it OK now?

Yes, much better. However, I've made some updates to make it even better: i) added proper formatting, ii) fixed spelling errors, iii) move the most important information to the beginning.

Cant compilation be executed completely in background? The standard solution is bang! It is kind of a feature request but I don't see a reason it would do this.

This is the intended behaviour, so you might be experiencing a bug. I will try to reproduce it. But please: There is absolutely no reason to be rude. "The standard solution is bang!" is not the way to express yourself. I am spending my spare time maintaining and developing vimtex, and the least I expect from users are for them to be polite when raising issues/feature requests.

I expect it not to get out of visual mode, but to execute in the background.

Thanks, this makes things much more clear.

Regarding your configuration: You have not specified a minimal vimrc, only the configuration you use in your vimrc (I assume). Further, do you need set updatetime = 3000 to reproduce this? If not, it should not be included!

I will try to reproduce things even without a fully minimal example.

lervag commented 4 years ago

Ok: I still can't reproduce this. So, please provide a full minimal example. Let me know if you need help with that.

eyalk5 commented 4 years ago

Sorry, I didn't mean to be rude. The bang is just a suggestion. And it is a common way to provide additional mode of "silent" to a command. For me it happens every 5 minutes, when I need to press gv to get back to visual mode. Thanks for the try. I will try to produce it minimally. You are just not quick enough with the visual mode?

lervag commented 4 years ago

Sorry, I didn't mean to be rude. The bang is just a suggestion. And it is a common way to provide additional mode of "silent" to a command.

Ah, that's good. I mistook the "bang" sentence as being offensive, not as a suggestion to use :!. But you can be sure that I know about :! and friends for running jobs! Vimtex uses several different methods to run processes in the background, and the preferred method is to use Vim or neovims job feature.

For me it happens every 5 minutes, when I need to press gv to get back to visual mode.

Thanks for the try. I will try to produce it minimally. You are just not quick enough with the visual mode?

No, I'm pretty sure that I'm quick enough. :) Let me know if you can provide a more minimal example. The most important part is to identify a minimal vimrc file. So I would start with that.

eyalk5 commented 4 years ago

Yes, I tried to reproduce it using minimal vimrc. It doesn't happen in nvim in TUI. It just happens in neovim-qt. I tried to run it minimally with neovim-qt and couldn't make it work. So, I am not sure.

I was confused myself, since the issue happens on save (on compile on save), and not when executing :VimtexCompile.

lervag commented 4 years ago

Thanks for the updates. I'm sorry to say I don't really have any idea how to help you with this. I don't use neovim-qt (don't really see why you would want it, either).

I see you have raised the issue upstream, and so I hope that may end up solving the issue.

Unless I can get a minimal configuration that makes it possible for me to reproduce the issue, there is really nothing more I can do.

eyalk5 commented 4 years ago

I don't think it is a bug on your side. It happens in the callbacks of nvr. I disabled the callbacks and it is OK.

lervag commented 4 years ago

I don't think it is a bug on your side. It happens in the callbacks of nvr. I disabled the callbacks and it is OK.

Ok, then I'll take the liberty of closing the issue.

eyalk5 commented 4 years ago

It is actually solved https://github.com/neovim/neovim/issues/12165 known nvr problem

lervag commented 4 years ago

Great, happy to hear it! :)