lervag / vimtex

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

zathura inserve search not work #2737

Closed ChenZhongPu closed 1 year ago

ChenZhongPu commented 1 year ago

The vimtex is installed via lazy.nvim. The config:

  {
    "lervag/vimtex",
    ft = { "tex", "bib" },
    config = function()
      vim.g.tex_flavor = "latex"
      vim.g.vimtex_view_method = "zathura"
    end,
  },

I followed the instructions, and installed zathura.

Given the minimal .tex example:

\documentclass{article}
\begin{document}
\section{ONE}
Some text.
\section{TWO}
Some text.
\end{document}

Both Compiling and forward search work, but the corresponding line in .tex did not get focused after clicking and holding <ctrl>. I also checked the similar issue-2662, but it did not help.

The complete viminfo:

System info:
  OS: Manjaro Linux
  Vim version: NVIM v0.9.0
  Has clientserver: true
  Servername: /run/user/1000/nvim.4053528.0

VimTeX project: hello
  base: hello.tex
  root: /home/zhongpu/Documents/Project/latex/reverse
  tex: /home/zhongpu/Documents/Project/latex/reverse/hello.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 12
      output: /tmp/nvim.zhongpu/Jsy9Aj/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'hello.tex'
      pid: 4053701
  viewer: Zathura
    xwin id: 146800643
    cmd_start: zathura  -x "/usr/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 3:1:'/home/zhongpu/Documents/Project/latex/reverse/hello.tex' 'hello.pdf'&
  qf method: LaTeX logfile
lervag commented 1 year ago

The config: …

You should remove the ft = part - don't lazy load VimTeX! I believe this is the reason things are not working.

You should configure your settings with the init key, not the config key. This is to ensure that the settings are configured before VimTeX is loaded. Also, you don't need to set g:tex_flavor. Essentially, your config can probably be simplified:

  {
    "lervag/vimtex",
    init = function()
      vim.g.vimtex_view_method = "zathura"
    end,
  },