lervag / vimtex

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

Unknown function: job_start #1484

Closed scrouthtv closed 5 years ago

scrouthtv commented 5 years ago

Trying to compile a simple document like this one:

\documentclass[a4paper]{article}

\begin{document}
Hello World.
\end{document}

in nvim 0.3.8-1 gives me this error:

Error detected while processing function vimtex#compiler#compile[5]..411[26]..418:  
line   25:
E117: Unknown function: job_start
E15: Invalid expression: job_start(l:cmd, l:options)

I once had a problem with other plugins installed via Arch's package manager but they should all be gone by now:

pacman -Q | grep *vim*                                                                                                                       neovim 0.3.8-1
python-pynvim 0.3.2-5
vim 8.1.1968-1
vim-runtime 8.1.1968-1
vim-spell-de 20190731-1

I am using vim-plug and the other plugins installed are airline, ncm2, some snippets, yarp, quicktex and some others but compiling doesnt work with them disabled either.

I think there was on issue on nvim with the functions being oddly named but it was fixed, on the other hand, there is this issue https://github.com/droptheplot/abcgo/issues/1 which exactly resembles my problem.

Is this a problem on my side or is vimtex not nvim compatible?

scrouthtv commented 5 years ago

Also here is VimtexInfo (on a similar document):

ystem info
  OS: Linux 5.2.13-arch1-1-ARCH
  Vim version: NVIM v0.3.8
  Has clientserver: true
  Servername: /tmp/nvim5c1Yvh/0

vimtex project: 1
  base: 1.tex
  root: /home/
  tex: /home/1.tex
  out: /home/1.pdf
  log: /home/1.log
  aux: /home/1.aux
  fls: 
  compiler: latexmk
    backend: jobs
    output: /tmp/nvim5c1Yvh/1
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
  viewer: General
  qf: LaTeX logfile
    config: 
      packages: 
        default: 1
      default: 1
  document class: article
  packages:
    amsmath
    amssymb
    amsthm
    chemfig
    chemmacros
    geometry
    mathtools
    siunitx
clason commented 5 years ago

Vimtex is definitely neovim-compatible :)

Have you looked at https://github.com/lervag/vimtex/wiki/introduction#neovim or :h vimtex-faq-neovim? (In particular, you need the neovim-remote python package.)

scrouthtv commented 5 years ago

That's the part of the installation I didn't fully understand :(

I installed the neovim-remote package using pip but still get the same error message. Do I run nvr instead of nvim and what is with the parameters? Where exactly do I set the editor command of my viewer configuration?

Thanks for your help

clason commented 5 years ago

You need to set the let g:vimtex_compiler_progname = 'nvr' in your init.vim to have vimtex use it (and use it instead of vim --remote in your viewer for backward sync), but you start neovim as usual.

scrouthtv commented 5 years ago

I did that (the line comes after the line where the plugin is loaded) and restarted nvim but still get the same error message. Do I have to load the remote plugin too?

~/.config/nvim/init.vim:

call plug#begin('~/.vim/plugged')
Plug('lervag/vimtex')
" ...
call plug#end()

let g:vimtex_compiler_progname = 'nvr'
" ...

(The variable is even set inside of vim:

" echom vimtex_compiler_progname
nvr                                                     
" \ll                            
Error detected while processing function vimtex#compiler#compile[5]..411[26]..418:
line   25:
E117: Unknown function: job_start
E15: Invalid expression: job_start(l:cmd, l:options)

) My command line is nvim 1.tex.

lervag commented 5 years ago

Your problem is not with nvr. The problem is probably related to your vimtex configuration. Can you please post your let g:vimtex_ lines from your init.vim here?

I believe you have something like this there:

let g:vimtex_compiler_latexmk = {
    \ 'backend' : 'jobs',
    \ ...
    \}

The 'backend' key is explained in the docs, see :help g:vimtex_compiler_latexmk. You should not specify it unless you know what you are doing. The default value should work as expected.

scrouthtv commented 5 years ago

Compilation works fine with removing the entire compiler_latexmk variable.

Thanks for the help!